PageSourceSearch

https://pressthink.org/j/rosen-archive/frontend/utils/consoleWatchdog.js?v=3.8.36

js pressthink.org collected 2026-10-02 04:25:56 UTC 1,182 bytes, 33 lines download raw bytes

1// The console watchdog (#754): one small dog, printed once per page load, for
2// anyone who opens developer tools. It is silent, additive, and self-contained
3// — no local imports — so the Node suite can import it by bare path.
4
5export const WATCHDOG_MESSAGE = 'woof. the press is a public trust.';
6
7export const WATCHDOG_ART = [
8  '     __      _',
9  "    o'')}____//",
10  '     `_/      )',
11  '     (_(_/-(_/',
12].join('\n');
13
14const WATCHDOG_STYLE = 'color: #78716c; font-family: "Roboto Mono", monospace; line-height: 1.2;';
15
16// Module state, not page state: the dog barks once per load, however many
17// times a caller asks.
18let alreadyLogged = false;
19
20/**
21 * Print the watchdog once. Returns true on the printing call and false on
22 * every later call, so a second import or a re-render cannot repeat it.
23 */
24export function logWatchdog(target = typeof console === 'undefined' ? null : console) {
25  if (alreadyLogged) return false;
26  if (!target || typeof target.log !== 'function') return false;
27
28  alreadyLogged = true;
29  target.log(`%c${WATCHDOG_ART}\n${WATCHDOG_MESSAGE}`, WATCHDOG_STYLE);
30  return true;
31}
32
33export default { logWatchdog, WATCHDOG_ART, WATCHDOG_MESSAGE };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.