LogTape 1.3.0: Framework integrations and SDK-friendly logging #109
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.
-
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.
Version 1.3.0 is our biggest release yet, bringing first-class integrations for the most popular web frameworks and a powerful new feature for SDK authors. Here's what's new.
Category prefix for library authors
If you've ever built an SDK that wraps other libraries, you've probably run into this problem: logs from your internal dependencies show up with their category names, not yours. Application developers configuring logging for your SDK have no idea they also need to configure every internal library you happen to use.
The new
withCategoryPrefix()function solves this by prepending your SDK's category to all log records within a callback context:Now application developers can configure logging for
["my-sdk"]and automatically capture all internal logs without knowing anything about your implementation details. Prefixes accumulate when nested, so multi-layer architectures work naturally.This feature uses the same
contextLocalStorageconfiguration as implicit contexts, so if you're already usingwithContext(), no additional setup is required. See the category prefix documentation for more details.Web framework integrations
LogTape now provides official middleware packages for the four most popular Node.js web frameworks. Each offers Morgan-compatible format presets, custom format functions, structured logging output, and request filtering.
Express
The @logtape/express package provides HTTP request logging as a drop-in replacement for Morgan:
Fastify
The @logtape/fastify package provides a Pino-compatible logger that integrates with Fastify's built-in logging system:
The adapter supports all Pino method signatures including printf-style interpolation (
%s,%d,%j,%o), andchild()bindings map to LogTape'sLogger.with().Hono
The @logtape/hono package works across all of Hono's supported runtimes—Cloudflare Workers, Deno, Bun, and Node.js:
Koa
The @logtape/koa package provides middleware for Koa applications:
All four packages share a consistent API: predefined formats (
combined,common,dev,short,tiny), custom format functions,skipfor filtering, and structured logging output with fields likemethod,url,status,responseTime,userAgent, and more.See the framework integration documentation for complete details.
Drizzle ORM integration
The new @logtape/drizzle-orm package lets you use LogTape as Drizzle's logging backend:
Each query is logged with structured data:
formattedQuery(with parameter values substituted for readability),query(original parameterized string), andparams(original array). This gives you human-readable output with text formatters while preserving full query data for OpenTelemetry, Sentry, or JSON Lines sinks.OpenTelemetry protocol expansion
The @logtape/otel package now supports all three OTLP protocols:
http/json: HTTP with JSON encoding (default, works everywhere including browsers)http/protobuf: HTTP with Protocol Buffers encoding (more efficient)grpc: gRPC protocol (most efficient for high-volume logging, Node.js/Deno/Bun only)Protocol selection follows the OpenTelemetry specification via environment variables (
OTEL_EXPORTER_OTLP_LOGS_PROTOCOLorOTEL_EXPORTER_OTLP_PROTOCOL). The gRPC exporter is dynamically imported only when needed, so browser bundles stay lean.A new
additionalResourceoption lets you add custom resource attributes without providing a full customLoggerProvider:Enhanced Sentry integration
The @logtape/sentry package now offers deeper integration with Sentry's observability features:
trace_idandspan_idfrom active Sentry spans with zero configuration.enableBreadcrumbs: trueto create a debugging context trail.enableLogs: true, the sink automatically uses Sentry's Logs API.beforeSendhook lets you transform or filter log records.Security improvements
This release includes important security fixes in @logtape/redaction: infinite loops when processing circular references, and missing redaction of sensitive data in class instances.
The @logtape/syslog package now supports TLS for TCP connections via the new
secureandtlsOptionsoptions.Upgrading
LogTape 1.3.0 is fully backward compatible with 1.2.x. Just update your packages:
npm update @logtape/logtape # or deno add jsr:@logtape/logtape@^1.3.0For the new integrations:
npm install @logtape/express @logtape/fastify @logtape/hono @logtape/koa @logtape/drizzle-orm # or deno add --jsr @logtape/express @logtape/fastify @logtape/hono @logtape/koa @logtape/drizzle-ormAll satellite packages share the same version number with the core package for easy dependency management. See the full changelog for complete details.
Beta Was this translation helpful? Give feedback.
All reactions