LogTape 0.9.0 Released: Synchronous Configuration and Better Runtime Compatibility

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

We're excited to announce the release of LogTape 0.9.0! This version brings important improvements to make LogTape more flexible across different JavaScript environments while simplifying configuration for common use cases.

What's New

  • Synchronous Configuration API: Added new synchronous configuration functions for environments where async operations aren't needed or desired
  • Improved Runtime Compatibility: Moved file-system dependent components to a separate package for better cross-runtime support

New Features

Synchronous Configuration API: Simplifying Your Setup

Added synchronous versions of the configuration functions:

  • configureSync(): Configure LogTape synchronously
  • disposeSync(): Dispose LogTape resources synchronously
  • resetSync(): Reset LogTape configuration synchronously

These functions offer a simpler API for scenarios where async operations aren't needed, allowing for more straightforward code without awaiting promises. Note that these functions cannot use sinks or filters that require asynchronous disposal (such as stream sinks), but they work perfectly for most common logging configurations.

import { configureSync, getConsoleSink } from "@logtape/logtape";

configureSync({ 
  sinks: {
    console: getConsoleSink(),
  },
  loggers: [
    {
      category: "my-app",
      lowestLevel: "info",
      sinks: ["console"],
    },
  ],
});

Console Sink Enhancements

  • Added ConsoleSinkOptions.levelMap option for customizing how log levels are mapped to console methods

Breaking Changes

File Sinks Moved to Separate Package: Better Cross-Platform Support

To improve runtime compatibility, file-related sinks have been moved to the @logtape/file package:

  • Moved getFileSink() function to @logtape/file package
  • Moved FileSinkOptions interface to @logtape/file package
  • Moved getRotatingFileSink() function to @logtape/file package
  • Moved RotatingFileSinkOptions interface to @logtape/file package

This architectural change ensures the core @logtape/logtape package is fully compatible with all JavaScript runtimes, including browsers and edge functions, without introducing file system dependencies. You'll now enjoy better compatibility with bundlers like Webpack, Rollup, and Vite that previously had issues with the file system imports.

Migration Guide

If you were using file sinks, update your imports:

// Before
import { getFileSink, getRotatingFileSink } from "@logtape/logtape";

// After
import { getFileSink, getRotatingFileSink } from "@logtape/file";

Don't forget to install the new package:

# For npm, pnpm, Yarn, Bun
npm add @logtape/file

# For Deno
deno add jsr:@logtape/file

Looking Forward

This release represents our ongoing commitment to making LogTape the most flexible and developer-friendly logging solution for JavaScript and TypeScript applications. We're continuing to improve performance and extend compatibility across the JavaScript ecosystem.

Contributors

Special thanks to Murph Murphy for their valuable contribution to this release.


As always, we welcome your feedback and contributions! Feel free to open issues or pull requests on our GitHub repository.

Happy logging!

Read more →

An intersectionalist, feminist, and socialist guy living in Seoul (UTC+09:00). @tokolovesme금강토's spouse. Who's behind @fedifyFedify: an ActivityPub server framework, @hollo, and @botkitBotKit by Fedify :botkit:. Write some free software in , , , & . They/them.

서울에 사는 交叉女性主義者이자 社會主義者. 金剛兔(@tokolovesme금강토)의 配偶者. @fedifyFedify: an ActivityPub server framework, @hollo, @botkitBotKit by Fedify :botkit: 메인테이너. , , , 等으로 自由 소프트웨어 만듦.

()