@hongminhee@hollo.social

LogTape 2.4.0 is out. is a zero-dependency library for and that runs on , .js, , and browsers.

The main changes:

  • Opt-in source locations: captureSourceLocation records where each log call was made, and the text formatters can show it. Meant for development, since it costs a stack trace per call.
  • inspectLogger() reports how a logger's level, inherited sinks, and filters combine, so you can see why a record doesn't reach a sink.
  • parentSinks: "forward" lets a child category inherit its ancestors' sinks without their level thresholds.
  • drain() waits for pending sink output without disposing of the sinks, and fromAsyncSink() gets queue limits and a waitUntil hook for serverless platforms.
  • fingersCrossed() can go back to buffering after a trigger, and flush or discard buffers per request.
  • The Express, Hono, Koa, and Elysia integrations take a completionLevel callback that picks the log level from the response.

Two changes can affect existing code: getRotatingFileSink() now requires maxFiles to be an integer from 1 to 1,000, and TextFormatterOptions.value now also accepts "bare", so code that calls it directly has to check its type first.

https://github.com/dahlia/logtape/discussions/254

github.com

LogTape 2.4.0: Source locations, configuration inspection, sink draining, and request completion levels · dahlia/logtape · Discussion #254

LogTape is a logging library for JavaScript and TypeScript that works across Deno, Node.js, Bun, and browsers. It's built around structured logging, has zero dependencies, and is designed to work a...

1 like