Skip to content

v0.43.0 — per-request logging & redaction

Choose a tag to compare

@tshafer tshafer released this 11 Jul 06:55
· 115 commits to main since this release

Logging enhancements, inspired by Fastify's logging.

  • Per-request loggingrequestLogger() middleware binds a child logger with a generated reqId to each request, so every log line within a request correlates (Fastify's request.log). Logs request start/completion (method, path, status, ms) by default; options for genReqId, reusing an incoming idHeader (distributed tracing), and disabling the auto lines. requestLog() reaches the current request's logger anywhere.
  • Log redactionnew Logger({ redact: ["password", "req.headers.authorization"] }) replaces matched values (top-level keys or dot paths) with "[redacted]" without mutating the logged object; inherited by child loggers.

275 tests; type-checked doc examples. See docs/logger.md.