LogTape 0.12.0 Release Notes

洪 民憙 (Hong Minhee) @hongminhee@hackers.pub

LogTape is a zero-dependency logging library for JavaScript and TypeScript that provides a simple yet flexible logging system. It supports multiple JavaScript runtimes (Deno, Node.js, Bun, browsers, and edge functions), features hierarchical categories, structured logging, and offers seamless integration for both applications and libraries.

What's New in 0.12.0

Trace Log Level

LogTape now includes a trace severity level, which sits below debug in the verbosity hierarchy. This addition provides finer-grained control over logging output, particularly useful for detailed execution flow tracking during development and debugging.

  • Added "trace" to the LogLevel union type
  • Added Logger.trace() method for logging trace-level messages
  • The complete severity hierarchy is now: trace < debug < info < warning < error < fatal

Enhanced File Sink Performance

File sinks now support configurable buffering, significantly improving write performance for high-volume logging scenarios.

  • Added bufferSize option (default: 8192 characters) to control write buffering behavior
  • Added flushInterval option (default: 5000ms) for automatic time-based buffer flushing
  • Set bufferSize to 0 for immediate writes without buffering
  • Set flushInterval to 0 to disable time-based flushing
  • Buffer contents are automatically flushed when the sink is disposed

These options are available for both getFileSink() and getRotatingFileSink() functions.

Syslog Support

The new @logtape/syslog package enables sending log messages to syslog servers using the RFC 5424 format.

  • Support for both UDP and TCP protocols
  • All standard RFC 5424 facilities (kern, user, mail, daemon, local07, etc.)
  • Automatic priority calculation based on log levels
  • Structured data support for log record properties
  • Cross-runtime compatibility with Deno, Node.js, and Bun
  • Configurable connection timeouts, custom hostnames, and application names

Logger Method Alias

Added Logger.warning() as an alias for Logger.warn() to ensure consistency with the LogLevel type definition. This change addresses the naming mismatch where the LogLevel union type uses "warning" while the logger method was named warn(), making metaprogramming and dynamic method invocation more straightforward.

Unified Package Releases

Starting with version 0.12.0, all LogTape packages including @logtape/otel, @logtape/sentry, and @logtape/syslog share the same version number and are released together. This ensures compatibility between packages and simplifies version management for users.

Improved Build Infrastructure

LogTape has migrated from dnt to tsdown for npm package bundling. tsdown is a library-focused bundler built on top of Rolldown, a Rust-based bundler that powers the next generation of Vite. Unlike general-purpose bundlers, tsdown is specifically optimized for building TypeScript and JavaScript libraries with minimal configuration. This change brings several benefits:

  • Elimination of bundler warnings in Webpack, Vite, and other build tools
  • Improved compatibility with modern JavaScript toolchains
  • Better tree-shaking support
  • Cleaner package output
  • Faster build times through Rust-based performance optimizations

Migration Guide

Updating to Trace Level

If you have code that relies on debug being the lowest severity level, you may need to update your log level configurations:

// Before
{ lowestLevel: "debug" }  // This was the most verbose setting

// After
{ lowestLevel: "trace" }  // Now includes trace messages

Leveraging Buffer Configuration

To optimize file sink performance in high-throughput scenarios:

getFileSink("app.log", {
  bufferSize: 16384,      // Larger buffer for better performance
  flushInterval: 10_000    // Flush every 10 seconds
})

Installation

LogTape 0.12.0 is available on JSR and npm:

deno add jsr:@logtape/logtape  # Deno
npm  add     @logtape/logtape  # npm
pnpm add     @logtape/logtape  # pnpm
yarn add     @logtape/logtape  # yarn
bun  add     @logtape/logtape  # Bun

For the syslog sink:

deno add jsr:@logtape/syslog  # Deno
npm  add     @logtape/syslog  # npm
pnpm add     @logtape/syslog  # pnpm
yarn add     @logtape/syslog  # yarn
bun  add     @logtape/syslog  # Bun

Acknowledgments

We thank all contributors who helped make this release possible, including those who reported issues, submitted pull requests, and provided feedback.

For the complete list of changes, please refer to the changelog.

9

No comments

If you have a fediverse account, you can comment on this article from your own instance. Search https://hackers.pub/ap/articles/01976f50-c9ce-7c2a-bbc2-7dcf614c276b on your instance and reply to it.