/** * Component-tagged logger factory for the hq-cloud sync subsystem * (project event-driven-sync-menubar US-011). * * Every log line emitted from a sync module SHOULD carry a `component` field * so operators can grep / route by subsystem in the aggregated JSON stream. * `createLogger({ component: "sync-watcher" })` is the canonical entry point — * modules call this once at module-load time and use the returned logger for * the lifetime of the process. * * The 3-log diagnostic chain (US-011) * ─────────────────────────────────── * Three correlated log lines share a single `sequenceNumber` join key so an * operator can walk one event end-to-end: * 1. `event=watcher.emit` — client push side (US-008 PushEventEmitter) * 2. `event=push.receive` — server side (hq-pro; context only here) * 3. `event=fanout.receive` — client fanout-receive side (US-009 receiver) * The watcher.emit + fanout.receive halves live in this client package; the * push.receive half lives server-side in hq-pro. All three stamp the same * `sequenceNumber` for log-chain correlation. * * Output format: pino's default newline-delimited JSON. No transports, no * pretty-printing — the daemon consumes the raw JSON stream. (Operators who * want pretty output pipe through `pino-pretty` themselves.) * * Destination injection: tests pass a `destination` stream so they can capture * log lines and assert on them. Production callers omit it and pino defaults * to `process.stdout`. * * Adapted from indigoai-us/hq-pro PR #112 (src/sync/logger.ts) into * @indigoai-us/hq-cloud (Path B). */ import { type DestinationStream, type Level, type Logger } from "pino"; export interface CreateLoggerOptions { /** * Component tag stamped on every log line as `"component": `. * Required so daemon / watcher / receiver lines never appear in the stream * untagged. */ component: string; /** * Optional pino level. Default: pino's own default (`info`). Set via * `LOG_LEVEL` env var, command-line flag, or test injection. */ level?: Level; /** * Optional pino destination. Default: `process.stdout`. Tests inject a * memory stream here to capture lines for assertion. */ destination?: DestinationStream; } /** * Build a pino logger pre-bound to a `component` tag. * * Use this — not a bare `pino()` call — so every sync module's log lines carry * the tag uniformly. Adding more bound fields (e.g. `deviceId`, `tenantId`) is * a `logger.child({ ... })` call away. */ export declare function createLogger(opts: CreateLoggerOptions): Logger; export type { Logger } from "pino"; //# sourceMappingURL=logger.d.ts.map