Skip to content
Warlock.js v4

Logger

Standalone — usable in any Node project, no @warlock.js/core required.

@warlock.js/logger is the logging primitive. Structured by default, channel-based (route different levels or modules to different sinks), with PII redaction built in, lifecycle hooks for app boot/shutdown, and buffered flushes so you never lose entries on a hard exit.

why logger

Production logging without ceremony

Five primitives that make logs you can actually trust in prod — not console noise.

Channels

One config, many sinks.

Register channels once; each one filters by level or a custom predicate. info to the console, JSON to a file, errors wherever you route them.

ts
log.configure({ channels: [new ConsoleLog(), new FileLog({ levels: ["error"] })] })

PII redaction

Sensitive fields, automatically masked.

Configure the paths once; values at those paths are scrubbed before they ever reach a sink.

ts
log.configure({ redact: { paths: ["context.token"] } })
log.info("auth", "signup", "ok", { email, token }) // token redacted

Graceful shutdown

No lost lines on exit.

Buffered writes flush on SIGTERM/SIGINT/beforeExit so the last entries survive a clean shutdown.

ts
log.configure({ autoFlushOn: ["SIGTERM", "SIGINT", "beforeExit"] })

Uncaught capture

Errors you didn't know to catch.

One call wires unhandledRejection + uncaughtException into your channels with the full stack and request context.

ts
captureAnyUnhandledRejection()

Ready to wire it in? Installation → — three lines, five minutes.