LogTape 1.2.0: Nested property access and context isolation #97
dahlia
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
LogTape is a logging library for JavaScript and TypeScript that works across Deno, Node.js, Bun, and browsers. It's built around structured logging with zero dependencies and flexible configuration.
We just released version 1.2.0 with several features that make working with structured data even more powerful. Here's what's new.
Nested property access in templates
You can now access nested properties directly in your message templates without having to flatten your data first. This was one of the most requested features, and it makes logging structured data much cleaner.
The syntax supports everything you'd expect: dot notation for nested objects, array indexing, bracket notation with quotes for property names that contain special characters, and optional chaining when you're not sure if a property exists. We also built in protection against prototype pollution by blocking access to
__proto__,prototype, andconstructorat any depth.For more details, check out the structured logging documentation.
Context-based isolation for fingers crossed sink
If you're using the fingers crossed sink (which buffers logs and only outputs them when something goes wrong), you can now isolate buffers by context. This is particularly useful for HTTP request tracing where you want each request's logs to be independent.
Each isolated context maintains its own trigger state and buffer, so logs from one request won't accidentally flush logs from another. The new memory management options (TTL, cleanup intervals, and LRU limits) ensure this won't leak memory in high-traffic applications.
Learn more about context isolation in the documentation.
Better custom formatting support
The text formatter's
valuecallback now receives the default cross-runtimeinspect()function as a second parameter. This makes it much easier to customize formatting for specific types while falling back to sensible defaults for everything else.You no longer need to reimplement the complex runtime detection logic yourself. See the
TextFormatterOptions.valuedocumentation for more details.Additional improvements
The @logtape/pretty package now supports
gettersandshowProxyoptions ininspectOptions, giving you fine-grained control over how objects and proxies appear in your logs. Check out thePrettyFormatterOptions.inspectOptionsdocumentation to learn more.The @logtape/redaction package now recursively redacts sensitive fields in objects nested within arrays, so your data stays protected even in complex structures.
Upgrading
If you're already using LogTape, upgrading to 1.2.0 is straightforward. The changes are backward compatible, so your existing code will continue to work. The only breaking change is for the
TextFormatterOptions.valuecallback, but the second parameter is optional, so even that won't break existing code.Just update
@logtape/logtapeand any other@logtape/*packages you're using to version 1.2.0. All the satellite packages (@logtape/file, @logtape/otel, @logtape/pretty, @logtape/redaction, @logtape/sentry, etc.) share the same version number with the core package, so keeping them in sync is straightforward.All reactions