@stamhoofd/node-logging
v2.161.1
Published
Readme
Simple logging
Helper library for nice, styleable and context aware logging.
This is the Node.js library @stamhoofd/node-logging. Inside this repository, declare it as
"@stamhoofd/node-logging": "workspace:*" in consuming packages. It uses Node's
AsyncLocalStorage and process streams; it is not a browser library.
Logger writes to injected streams and isolates prefixes and tags through
setContext. StyledText applies styles and tags; the exported logger uses
the process streams. Importing the package does not replace console methods;
infectConsole() does that explicitly.
debug(...) uses the same context and formatting as log(...), but can be disabled
before formatting with logger.debugEnabled = false. It defaults to enabled for
compatibility. infectConsole() routes console.debug through this setting;
ordinary logs, warnings and errors are unaffected.
Run pnpm stam test node-logging, pnpm stam check lint @stamhoofd/node-logging, and
pnpm stam check typecheck @stamhoofd/node-logging from the repository root. Builds emit
runtime JavaScript into dist and declarations into dist-types, retaining
the original assignment-style class fields and Chalk 4 dependency.
The Stamhoofd-specific logging wrapper remains @stamhoofd/logging in
backend/shared/logging; pnpm stam test logging still selects its tests.
