@warlock.js/logger 5.34.2 → 5.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/llms-full.txt +12 -12
- package/llms.txt +12 -12
- package/package.json +2 -2
- package/skills/index.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to `@warlock.js/logger` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
|
|
6
6
|
|
|
7
|
+
## 5.34.3 - 2026-10-20
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Condensed the package agent skill description to at most 450 characters, with API names and package routing guidance.
|
|
12
|
+
|
|
7
13
|
## 5.34.2 - 2026-10-19
|
|
8
14
|
|
|
9
15
|
### Fixed
|
package/llms-full.txt
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
## Package orientation
|
|
8
8
|
|
|
9
9
|
---
|
|
10
|
-
description: 'Structured logging
|
|
10
|
+
description: 'Structured logging with channels, filtering, redaction and shutdown flushing: `log`, `Logger`, `LogChannel`, `ConsoleLog`, `JSONFileLog`, `SentryLog` and `applyRedact`. Use for "log an error with context", "hide tokens", "write JSON logs", "send errors to Sentry" or "flush before exit". Not this package → @warlock.js/core for HTTP error responses; @warlock.js/ai-panoptic for agent traces and AI cost dashboards.'
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
# @warlock.js/logger
|
|
@@ -71,7 +71,7 @@ You write `log.info("auth", "login", "user signed in", { userId })`. The logger
|
|
|
71
71
|
- The `warlock-conventions` topic of the `warlock-js-core` skill — the parent framework's conventions; logger is one of its foundation packages and ships transitively when you install core.
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
## capture-unhandled-errors `@warlock.js/logger/capture-unhandled-errors/SKILL.md`
|
|
74
|
+
## capture-unhandled-errors `@warlock.js/logger/skills/capture-unhandled-errors/SKILL.md`
|
|
75
75
|
|
|
76
76
|
---
|
|
77
77
|
name: capture-unhandled-errors
|
|
@@ -185,7 +185,7 @@ Both listeners log with:
|
|
|
185
185
|
If you want these routed to a specific file, filter on `data.module === "app"`. See the `filter-log-entries` topic.
|
|
186
186
|
|
|
187
187
|
|
|
188
|
-
## configure-logger `@warlock.js/logger/configure-logger/SKILL.md`
|
|
188
|
+
## configure-logger `@warlock.js/logger/skills/configure-logger/SKILL.md`
|
|
189
189
|
|
|
190
190
|
---
|
|
191
191
|
name: configure-logger
|
|
@@ -291,7 +291,7 @@ See the `redact-sensitive-log-fields` topic for the redact contract and the `fil
|
|
|
291
291
|
- The `flush-logs-on-shutdown` topic — `autoFlushOn` event behavior
|
|
292
292
|
|
|
293
293
|
|
|
294
|
-
## filter-log-entries `@warlock.js/logger/filter-log-entries/SKILL.md`
|
|
294
|
+
## filter-log-entries `@warlock.js/logger/skills/filter-log-entries/SKILL.md`
|
|
295
295
|
|
|
296
296
|
---
|
|
297
297
|
name: filter-log-entries
|
|
@@ -415,7 +415,7 @@ Filters run on **every** entry per channel. A synchronous, cheap predicate is fi
|
|
|
415
415
|
The `minLevel` check is the fastest of the three (single comparison before fan-out), so prefer it when "drop everything below X uniformly" matches your need.
|
|
416
416
|
|
|
417
417
|
|
|
418
|
-
## flush-logs-on-shutdown `@warlock.js/logger/flush-logs-on-shutdown/SKILL.md`
|
|
418
|
+
## flush-logs-on-shutdown `@warlock.js/logger/skills/flush-logs-on-shutdown/SKILL.md`
|
|
419
419
|
|
|
420
420
|
---
|
|
421
421
|
name: flush-logs-on-shutdown
|
|
@@ -555,7 +555,7 @@ resolves so shutdown can continue. Timeout does not cancel a channel's network
|
|
|
555
555
|
operation; its driver owns cancellation.
|
|
556
556
|
|
|
557
557
|
|
|
558
|
-
## logger-basics `@warlock.js/logger/logger-basics/SKILL.md`
|
|
558
|
+
## logger-basics `@warlock.js/logger/skills/logger-basics/SKILL.md`
|
|
559
559
|
|
|
560
560
|
---
|
|
561
561
|
name: logger-basics
|
|
@@ -644,7 +644,7 @@ Every call signature is the same — `module`, `action`, `message`, optional `co
|
|
|
644
644
|
- Don't shadow the import in local code: `for (const log of logEntries) { ... }` will hide the singleton inside that block. Rename loop variables (`entry`, `record`) when working with logger imports.
|
|
645
645
|
|
|
646
646
|
|
|
647
|
-
## pick-log-channel `@warlock.js/logger/pick-log-channel/SKILL.md`
|
|
647
|
+
## pick-log-channel `@warlock.js/logger/skills/pick-log-channel/SKILL.md`
|
|
648
648
|
|
|
649
649
|
---
|
|
650
650
|
name: pick-log-channel
|
|
@@ -815,7 +815,7 @@ If two channels share a `name`, only one is reachable this way — the search re
|
|
|
815
815
|
- The `write-custom-log-channel` topic — extending `LogChannel` for custom sinks
|
|
816
816
|
|
|
817
817
|
|
|
818
|
-
## redact-sensitive-log-fields `@warlock.js/logger/redact-sensitive-log-fields/SKILL.md`
|
|
818
|
+
## redact-sensitive-log-fields `@warlock.js/logger/skills/redact-sensitive-log-fields/SKILL.md`
|
|
819
819
|
|
|
820
820
|
---
|
|
821
821
|
name: redact-sensitive-log-fields
|
|
@@ -1020,7 +1020,7 @@ Keys are normalized; values are exact literal substrings (punctuation is literal
|
|
|
1020
1020
|
Registration retains keys/values in memory for the process lifetime. Removed/rotated values stay protected. It does not protect prior logs, transformed/encoded credentials, direct console calls, third-party loggers or credentials never registered. Core's `secrets` store registers its encountered keys/values automatically. Keep credentials out of logs even with this protection enabled.
|
|
1021
1021
|
|
|
1022
1022
|
|
|
1023
|
-
## ship-logs-to-sentry `@warlock.js/logger/ship-logs-to-sentry/SKILL.md`
|
|
1023
|
+
## ship-logs-to-sentry `@warlock.js/logger/skills/ship-logs-to-sentry/SKILL.md`
|
|
1024
1024
|
|
|
1025
1025
|
---
|
|
1026
1026
|
name: ship-logs-to-sentry
|
|
@@ -1142,7 +1142,7 @@ The channel never crashes your app: the dynamic import failure is swallowed, the
|
|
|
1142
1142
|
- The `write-custom-log-channel` topic — build your own sink
|
|
1143
1143
|
|
|
1144
1144
|
|
|
1145
|
-
## test-logging-code `@warlock.js/logger/test-logging-code/SKILL.md`
|
|
1145
|
+
## test-logging-code `@warlock.js/logger/skills/test-logging-code/SKILL.md`
|
|
1146
1146
|
|
|
1147
1147
|
---
|
|
1148
1148
|
name: test-logging-code
|
|
@@ -1325,7 +1325,7 @@ process.emit("uncaughtException", new Error("test"), "uncaughtException");
|
|
|
1325
1325
|
See the `capture-unhandled-errors` topic for a full example.
|
|
1326
1326
|
|
|
1327
1327
|
|
|
1328
|
-
## use-log-helpers `@warlock.js/logger/use-log-helpers/SKILL.md`
|
|
1328
|
+
## use-log-helpers `@warlock.js/logger/skills/use-log-helpers/SKILL.md`
|
|
1329
1329
|
|
|
1330
1330
|
---
|
|
1331
1331
|
name: use-log-helpers
|
|
@@ -1395,7 +1395,7 @@ end({ rowsProcessed: report.rowCount });
|
|
|
1395
1395
|
- `log.timer` shorthand binds to the singleton — see the `test-logging-code` topic for how to swap channels per test.
|
|
1396
1396
|
|
|
1397
1397
|
|
|
1398
|
-
## write-custom-log-channel `@warlock.js/logger/write-custom-log-channel/SKILL.md`
|
|
1398
|
+
## write-custom-log-channel `@warlock.js/logger/skills/write-custom-log-channel/SKILL.md`
|
|
1399
1399
|
|
|
1400
1400
|
---
|
|
1401
1401
|
name: write-custom-log-channel
|
package/llms.txt
CHANGED
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
## Skills
|
|
8
8
|
|
|
9
|
-
- [Package orientation](@warlock.js/logger/skills/index.md): Structured logging
|
|
10
|
-
- [capture-unhandled-errors](@warlock.js/logger/capture-unhandled-errors/SKILL.md): captureAnyUnhandledRejection() installs process.on('unhandledRejection') → log.error and process.on('uncaughtException') → log.fatal + process.exit(1) so process-level failures land in your channels and a fatal crash is never silently swallowed into exit 0. Triggers: `captureAnyUnhandledRejection`, `exitOnUncaughtException`, `unhandledRejection`, `uncaughtException`, `log.error`, `log.fatal`; "log unhandled promise rejections", "catch uncaught exceptions to a file", "record crashes before exit", "server exits 0 with no error", "silent exit / production server stopped", "global error handler with logger"; typical import `import { captureAnyUnhandledRejection, log } from "@warlock.js/logger"`. Skip: flushing — the `flush-logs-on-shutdown` topic; filtering — the `filter-log-entries` topic; competing `Sentry.init`, `@sentry/node`; native `process.on('unhandledRejection')`.
|
|
11
|
-
- [configure-logger](@warlock.js/logger/configure-logger/SKILL.md): Register channels via log.addChannel / log.setChannels / log.configure({channels, autoFlushOn, redact, minLevel}) at boot. Triggers: `log.configure`, `log.addChannel`, `log.setChannels`, `Logger`, `autoFlushOn`, `disableAutoFlush`; "wire channels at startup", "branch logger by NODE_ENV", "isolate a library's logger", "replace channel list"; typical import `import { log, Logger, ConsoleLog, FileLog } from "@warlock.js/logger"`. Skip: channel picks — the `pick-log-channel` topic; flushing — the `flush-logs-on-shutdown` topic; redaction — the `redact-sensitive-log-fields` topic; competing libs `winston.createLogger`, `pino`.
|
|
12
|
-
- [filter-log-entries](@warlock.js/logger/filter-log-entries/SKILL.md): Drop log entries — per-channel levels whitelist, per-channel filter predicate, logger-wide setMinLevel(level) fast path. Triggers: `levels`, `filter`, `minLevel`, `log.setMinLevel`, `shouldBeLogged`, `LoggingData`, `LogLevel`; "silence a noisy module", "route errors to a dedicated file", "raise global severity floor", "drop debug logs in prod"; typical import `import { log } from "@warlock.js/logger"`. Skip: custom sinks — the `write-custom-log-channel` topic; channel picks — the `pick-log-channel` topic; competing libs `pino.levels`, `winston.format.filter`, `debug` env var.
|
|
13
|
-
- [flush-logs-on-shutdown](@warlock.js/logger/flush-logs-on-shutdown/SKILL.md): Drain buffered channels before exit — log.flushSync() or log.configure({autoFlushOn: ['SIGINT', 'SIGTERM', 'beforeExit']}) installs handlers that re-raise the signal. Triggers: `log.flush`, `log.flushSync`, `onChannelError`, `log.flush({ timeout })`, `autoFlushOn`, `enableAutoFlush`, `disableAutoFlush`, `SIGINT`, `SIGTERM`, `beforeExit`; "drain logs before exit", "await log.flush() before process.exit", "drain async or network channels on shutdown", "wire SIGTERM for container shutdown", "my logs never showed after a crash", "graceful shutdown logging"; typical import `import { log, FileLog } from "@warlock.js/logger"`. Skip: error capture — the `capture-unhandled-errors` topic; custom sinks — the `write-custom-log-channel` topic; competing `pino.final`, `winston.end`; native `process.on('exit')`.
|
|
14
|
-
- [logger-basics](@warlock.js/logger/logger-basics/SKILL.md): Start here for @warlock.js/logger channels, structured entries, transports, and application logging setup.
|
|
15
|
-
- [pick-log-channel](@warlock.js/logger/pick-log-channel/SKILL.md): Pick one of the four built-in channels — ConsoleLog (terminal), FileLog (plain text on disk), JSONFileLog (structured JSON for aggregators like Loki / Datadog / Elastic), SentryLog (forwards errors + breadcrumbs to Sentry). Triggers: `ConsoleLog`, `FileLog`, `JSONFileLog`, `SentryLog`, `chunk`, `rotate`, `groupBy`, `maxFileSize`, `showContext`, `log.channel`; "log to a file", "rotate log files", "daily log chunks", "json logs for datadog / loki / elastic", "send logs to Sentry"; typical import `import { ConsoleLog, FileLog, JSONFileLog, SentryLog } from "@warlock.js/logger"`. Skip: Sentry-specific setup — the `ship-logs-to-sentry` topic; custom sinks — the `write-custom-log-channel` topic; registration — the `configure-logger` topic; competing libs `winston-daily-rotate-file`, `pino-pretty`.
|
|
16
|
-
- [redact-sensitive-log-fields](@warlock.js/logger/redact-sensitive-log-fields/SKILL.md): Strip secrets from log output — a built-in secret-key denylist on by default (DEFAULT_REDACT_KEYS), plus two-layer additive redaction via log.configure({redact: {paths, keys}}) (logger floor) + per-channel redact (more on top). Dotted glob paths (*, **). Triggers: `redact`, `paths`, `keys`, `defaultKeys`, `censor`, `log.setRedact`, `applyRedact`, `maskEmail`, `maskEmailsInText`, `registerLogSecret`, `maskRegisteredLogSecrets`; "redact passwords in logs", "strip tokens from log output", "hide authorization headers", "scrub PII before logging", "turn off default redaction"; typical import `import { log } from "@warlock.js/logger"`. Skip: filtering — the `filter-log-entries` topic; custom sinks — the `write-custom-log-channel` topic; competing libs `pino.redact`, `fast-redact`.
|
|
17
|
-
- [ship-logs-to-sentry](@warlock.js/logger/ship-logs-to-sentry/SKILL.md): Forward log entries to Sentry with the SentryLog channel — error/warn become events (captureException/captureMessage), every other level a breadcrumb (no quota). @sentry/node is an OPTIONAL peer, lazily imported. Triggers: `SentryLog`, `@sentry/node`, `eventLevels`, `flushTimeout`, `Sentry.flush`, `captureException`, `addBreadcrumb`, `withScope`; "send logs to Sentry", "report errors to Sentry", "Sentry log channel", "Sentry breadcrumbs from logs", "log channel for Sentry"; typical import `import { SentryLog } from "@warlock.js/logger"`. Skip: file/console channels — the `pick-log-channel` topic; custom sinks — the `write-custom-log-channel` topic; graceful-shutdown flushing — the `flush-logs-on-shutdown` topic; Slack alerting recipe.
|
|
18
|
-
- [test-logging-code](@warlock.js/logger/test-logging-code/SKILL.md): Test code that touches the logger — silence globally via log.setChannels([]) in setupFiles, assert specific log lines via a capturing LogChannel subclass (prefer it over vi.spyOn — it asserts on delivered entries, not just method calls, and isolates the shared singleton cleanly). Triggers: `log.setChannels`, `LogChannel`, `LoggingData`, `Logger`, `log.channels`; "silence logger in vitest", "assert a log line was emitted", "capture log output in tests", "test code that logs"; typical import `import { log, Logger, LogChannel, type LoggingData } from "@warlock.js/logger"`. Skip: custom sinks — the `write-custom-log-channel` topic; filtering — the `filter-log-entries` topic; competing `vi.spyOn(console)`, `jest.spyOn`.
|
|
19
|
-
- [use-log-helpers](@warlock.js/logger/use-log-helpers/SKILL.md): Two DX shortcuts on every Logger — log.assert(condition, module, action, message, context?) logs an error when condition is falsy (free on the happy path), log.timer(module, action) returns an end-function emitting an info entry with measured duration. Triggers: `log.assert`, `log.timer`, `durationMs`; "assert an invariant via logger", "measure how long an operation took", "time a request", "log operation duration"; typical import `import { log } from "@warlock.js/logger"`. Skip: basics — the `logger-basics` topic; filtering — the `filter-log-entries` topic; competing `console.assert`, `console.time`, `console.timeEnd`, `perf_hooks.performance.now`.
|
|
20
|
-
- [write-custom-log-channel](@warlock.js/logger/write-custom-log-channel/SKILL.md): Extend the abstract LogChannel class for custom sinks — Slack, database, HTTP endpoint, in-memory buffer. Triggers: `LogChannel`, `LogContract`, `LoggingData`, `shouldBeLogged`, `init`, `flush`, `flushSync`, `terminal`; "log to slack", "log to a database", "send logs to datadog / loki HTTP api", "in-memory test capture channel", "build a custom log sink"; typical import `import { LogChannel, type LoggingData, type LogContract } from "@warlock.js/logger"`. Skip: built-in channels — the `pick-log-channel` topic; filtering — the `filter-log-entries` topic; competing libs `winston-transport`, `pino-transport`.
|
|
9
|
+
- [Package orientation](@warlock.js/logger/skills/index.md): Structured logging with channels, filtering, redaction and shutdown flushing: `log`, `Logger`, `LogChannel`, `ConsoleLog`, `JSONFileLog`, `SentryLog` and `applyRedact`. Use for "log an error with context", "hide tokens", "write JSON logs", "send errors to Sentry" or "flush before exit". Not this package → @warlock.js/core for HTTP error responses; @warlock.js/ai-panoptic for agent traces and AI cost dashboards.
|
|
10
|
+
- [capture-unhandled-errors](@warlock.js/logger/skills/capture-unhandled-errors/SKILL.md): captureAnyUnhandledRejection() installs process.on('unhandledRejection') → log.error and process.on('uncaughtException') → log.fatal + process.exit(1) so process-level failures land in your channels and a fatal crash is never silently swallowed into exit 0. Triggers: `captureAnyUnhandledRejection`, `exitOnUncaughtException`, `unhandledRejection`, `uncaughtException`, `log.error`, `log.fatal`; "log unhandled promise rejections", "catch uncaught exceptions to a file", "record crashes before exit", "server exits 0 with no error", "silent exit / production server stopped", "global error handler with logger"; typical import `import { captureAnyUnhandledRejection, log } from "@warlock.js/logger"`. Skip: flushing — the `flush-logs-on-shutdown` topic; filtering — the `filter-log-entries` topic; competing `Sentry.init`, `@sentry/node`; native `process.on('unhandledRejection')`.
|
|
11
|
+
- [configure-logger](@warlock.js/logger/skills/configure-logger/SKILL.md): Register channels via log.addChannel / log.setChannels / log.configure({channels, autoFlushOn, redact, minLevel}) at boot. Triggers: `log.configure`, `log.addChannel`, `log.setChannels`, `Logger`, `autoFlushOn`, `disableAutoFlush`; "wire channels at startup", "branch logger by NODE_ENV", "isolate a library's logger", "replace channel list"; typical import `import { log, Logger, ConsoleLog, FileLog } from "@warlock.js/logger"`. Skip: channel picks — the `pick-log-channel` topic; flushing — the `flush-logs-on-shutdown` topic; redaction — the `redact-sensitive-log-fields` topic; competing libs `winston.createLogger`, `pino`.
|
|
12
|
+
- [filter-log-entries](@warlock.js/logger/skills/filter-log-entries/SKILL.md): Drop log entries — per-channel levels whitelist, per-channel filter predicate, logger-wide setMinLevel(level) fast path. Triggers: `levels`, `filter`, `minLevel`, `log.setMinLevel`, `shouldBeLogged`, `LoggingData`, `LogLevel`; "silence a noisy module", "route errors to a dedicated file", "raise global severity floor", "drop debug logs in prod"; typical import `import { log } from "@warlock.js/logger"`. Skip: custom sinks — the `write-custom-log-channel` topic; channel picks — the `pick-log-channel` topic; competing libs `pino.levels`, `winston.format.filter`, `debug` env var.
|
|
13
|
+
- [flush-logs-on-shutdown](@warlock.js/logger/skills/flush-logs-on-shutdown/SKILL.md): Drain buffered channels before exit — log.flushSync() or log.configure({autoFlushOn: ['SIGINT', 'SIGTERM', 'beforeExit']}) installs handlers that re-raise the signal. Triggers: `log.flush`, `log.flushSync`, `onChannelError`, `log.flush({ timeout })`, `autoFlushOn`, `enableAutoFlush`, `disableAutoFlush`, `SIGINT`, `SIGTERM`, `beforeExit`; "drain logs before exit", "await log.flush() before process.exit", "drain async or network channels on shutdown", "wire SIGTERM for container shutdown", "my logs never showed after a crash", "graceful shutdown logging"; typical import `import { log, FileLog } from "@warlock.js/logger"`. Skip: error capture — the `capture-unhandled-errors` topic; custom sinks — the `write-custom-log-channel` topic; competing `pino.final`, `winston.end`; native `process.on('exit')`.
|
|
14
|
+
- [logger-basics](@warlock.js/logger/skills/logger-basics/SKILL.md): Start here for @warlock.js/logger channels, structured entries, transports, and application logging setup.
|
|
15
|
+
- [pick-log-channel](@warlock.js/logger/skills/pick-log-channel/SKILL.md): Pick one of the four built-in channels — ConsoleLog (terminal), FileLog (plain text on disk), JSONFileLog (structured JSON for aggregators like Loki / Datadog / Elastic), SentryLog (forwards errors + breadcrumbs to Sentry). Triggers: `ConsoleLog`, `FileLog`, `JSONFileLog`, `SentryLog`, `chunk`, `rotate`, `groupBy`, `maxFileSize`, `showContext`, `log.channel`; "log to a file", "rotate log files", "daily log chunks", "json logs for datadog / loki / elastic", "send logs to Sentry"; typical import `import { ConsoleLog, FileLog, JSONFileLog, SentryLog } from "@warlock.js/logger"`. Skip: Sentry-specific setup — the `ship-logs-to-sentry` topic; custom sinks — the `write-custom-log-channel` topic; registration — the `configure-logger` topic; competing libs `winston-daily-rotate-file`, `pino-pretty`.
|
|
16
|
+
- [redact-sensitive-log-fields](@warlock.js/logger/skills/redact-sensitive-log-fields/SKILL.md): Strip secrets from log output — a built-in secret-key denylist on by default (DEFAULT_REDACT_KEYS), plus two-layer additive redaction via log.configure({redact: {paths, keys}}) (logger floor) + per-channel redact (more on top). Dotted glob paths (*, **). Triggers: `redact`, `paths`, `keys`, `defaultKeys`, `censor`, `log.setRedact`, `applyRedact`, `maskEmail`, `maskEmailsInText`, `registerLogSecret`, `maskRegisteredLogSecrets`; "redact passwords in logs", "strip tokens from log output", "hide authorization headers", "scrub PII before logging", "turn off default redaction"; typical import `import { log } from "@warlock.js/logger"`. Skip: filtering — the `filter-log-entries` topic; custom sinks — the `write-custom-log-channel` topic; competing libs `pino.redact`, `fast-redact`.
|
|
17
|
+
- [ship-logs-to-sentry](@warlock.js/logger/skills/ship-logs-to-sentry/SKILL.md): Forward log entries to Sentry with the SentryLog channel — error/warn become events (captureException/captureMessage), every other level a breadcrumb (no quota). @sentry/node is an OPTIONAL peer, lazily imported. Triggers: `SentryLog`, `@sentry/node`, `eventLevels`, `flushTimeout`, `Sentry.flush`, `captureException`, `addBreadcrumb`, `withScope`; "send logs to Sentry", "report errors to Sentry", "Sentry log channel", "Sentry breadcrumbs from logs", "log channel for Sentry"; typical import `import { SentryLog } from "@warlock.js/logger"`. Skip: file/console channels — the `pick-log-channel` topic; custom sinks — the `write-custom-log-channel` topic; graceful-shutdown flushing — the `flush-logs-on-shutdown` topic; Slack alerting recipe.
|
|
18
|
+
- [test-logging-code](@warlock.js/logger/skills/test-logging-code/SKILL.md): Test code that touches the logger — silence globally via log.setChannels([]) in setupFiles, assert specific log lines via a capturing LogChannel subclass (prefer it over vi.spyOn — it asserts on delivered entries, not just method calls, and isolates the shared singleton cleanly). Triggers: `log.setChannels`, `LogChannel`, `LoggingData`, `Logger`, `log.channels`; "silence logger in vitest", "assert a log line was emitted", "capture log output in tests", "test code that logs"; typical import `import { log, Logger, LogChannel, type LoggingData } from "@warlock.js/logger"`. Skip: custom sinks — the `write-custom-log-channel` topic; filtering — the `filter-log-entries` topic; competing `vi.spyOn(console)`, `jest.spyOn`.
|
|
19
|
+
- [use-log-helpers](@warlock.js/logger/skills/use-log-helpers/SKILL.md): Two DX shortcuts on every Logger — log.assert(condition, module, action, message, context?) logs an error when condition is falsy (free on the happy path), log.timer(module, action) returns an end-function emitting an info entry with measured duration. Triggers: `log.assert`, `log.timer`, `durationMs`; "assert an invariant via logger", "measure how long an operation took", "time a request", "log operation duration"; typical import `import { log } from "@warlock.js/logger"`. Skip: basics — the `logger-basics` topic; filtering — the `filter-log-entries` topic; competing `console.assert`, `console.time`, `console.timeEnd`, `perf_hooks.performance.now`.
|
|
20
|
+
- [write-custom-log-channel](@warlock.js/logger/skills/write-custom-log-channel/SKILL.md): Extend the abstract LogChannel class for custom sinks — Slack, database, HTTP endpoint, in-memory buffer. Triggers: `LogChannel`, `LogContract`, `LoggingData`, `shouldBeLogged`, `init`, `flush`, `flushSync`, `terminal`; "log to slack", "log to a database", "send logs to datadog / loki HTTP api", "in-memory test capture channel", "build a custom log sink"; typical import `import { LogChannel, type LoggingData, type LogContract } from "@warlock.js/logger"`. Skip: built-in channels — the `pick-log-channel` topic; filtering — the `filter-log-entries` topic; competing libs `winston-transport`, `pino-transport`.
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@mongez/copper": "^2.1.3",
|
|
6
6
|
"@mongez/reinforcements": "^4.0.2",
|
|
7
|
-
"@warlock.js/fs": "5.
|
|
7
|
+
"@warlock.js/fs": "5.35.0",
|
|
8
8
|
"dayjs": "^1.11.9",
|
|
9
9
|
"safe-stable-stringify": "^2.5.0"
|
|
10
10
|
},
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"warlock": {
|
|
34
34
|
"environment": "server"
|
|
35
35
|
},
|
|
36
|
-
"version": "5.
|
|
36
|
+
"version": "5.35.0",
|
|
37
37
|
"main": "./cjs/index.cjs",
|
|
38
38
|
"module": "./esm/index.mjs",
|
|
39
39
|
"types": "./esm/index.d.mts",
|
package/skills/index.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: 'Structured logging
|
|
2
|
+
description: 'Structured logging with channels, filtering, redaction and shutdown flushing: `log`, `Logger`, `LogChannel`, `ConsoleLog`, `JSONFileLog`, `SentryLog` and `applyRedact`. Use for "log an error with context", "hide tokens", "write JSON logs", "send errors to Sentry" or "flush before exit". Not this package → @warlock.js/core for HTTP error responses; @warlock.js/ai-panoptic for agent traces and AI cost dashboards.'
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# @warlock.js/logger
|