opensourceprojects.dev

A broadsheet for software that doesn't ask for your email

LogTape: a zero-dependency logger that lets libraries log without configuration
GitHub RepoImpressions4

Project Description

View on GitHub

LogTape: The Zero-Dependency Logger That Lets Your Library Stay Quiet

You know the drill. You're building a library, and you want to log a few helpful messages for debugging. But if you pull in a logging dependency, you're forcing your users to configure it—or worse, you're polluting their console with your noise. So you either skip logging entirely or roll your own half-baked solution. LogTape is built to break that trade-off.

LogTape is a logging library for JavaScript and TypeScript with a "library-first" philosophy. It's designed so your library can log safely without requiring any setup from the consumer, while the application that uses your library still gets full control over what appears and where. And it does this with zero dependencies.

What It Does

At its core, LogTape is a structured logging library that runs across Deno, Node.js, Bun, browsers, and edge functions. The code you write stays the same regardless of the runtime—no environment-specific branching required.

The architecture is built around a few key ideas:

  • Zero dependencies: LogTape itself has no dependencies, so adding it to your project doesn't drag in a dependency tree you need to audit.
  • Hierarchical categories: Loggers are organized in a category hierarchy (think app:database:queries), and you can set log levels at any point in that hierarchy. This gives you fine-grained control—you can silence one subcategory while keeping verbose logging elsewhere.
  • Structured logging: You can log messages with structured data attached, not just plain strings.
  • Template literal support: You can use template literals directly in log calls, which keeps interpolation clean and readable.
  • Built-in data redaction: Sensitive information can be redacted from logs using pattern-based or field-based rules.
  • Simple sink interface: Adding your own output destination (a "sink") is straightforward—you're not fighting a complex plugin API.

There's also first-class integration with popular frameworks like Express, Fastify, GraphQL Yoga, Hono, Koa, and Drizzle ORM. These integrations give you automatic HTTP request logging, GraphQL server logging, and database query logging without writing middleware yourself.

Why It's Cool

The library-first angle is what makes LogTape genuinely different. Most loggers are designed bottom-up: the application configures everything, and libraries are expected to stay quiet or use a no-op fallback. LogTape flips that.

  • Libraries can log without apology. You can add LogTape to your library and emit log messages freely. If the consuming application hasn't configured LogTape, your logs simply go nowhere—no errors, no console spam. If they have configured it, your logs flow into their pipeline with proper category-based filtering. That's a huge win for library maintainers who want debugging visibility without imposing on users.

  • The runtime support is genuinely broad. Deno, Node.js, Bun, browsers, edge functions—that's not a marketing list, that's practical coverage. If you're building a library that might run in multiple environments, you don't need to write adapter layers or conditional imports.

  • Redaction is built in, not bolted on. Logging sensitive data is a common footgun, and most loggers just let you shoot yourself. LogTape's pattern-based and field-based redaction means you can define rules once and trust that tokens, passwords, or API keys won't leak into your logs.

  • The framework integrations are practical. Automatic HTTP request logging for Express and Fastify, query logging for Drizzle ORM—these are the kinds of integrations you'd otherwise hand-roll or reach for a separate plugin package for. Having them as first-class features means less glue code in your project.

  • Zero dependencies is a real feature. In the JS ecosystem, "zero dependencies" often means "we reimplemented everything badly." Here it means you get structured logging, redaction, and runtime diversity without adding to your supply-chain risk or your bundle size.

How to Try It

LogTape is available on both JSR and npm. To install it, pick the command for your package manager:

deno add jsr:@logtape/logtape  # for Deno
npm add @logtape/logtape       # for npm
pnpm add @logtape/logtape      # for pnpm

From there, you can start logging with template literals right away. The getting started guide shows the basics, and the docs cover categories, structured logging, redaction, and custom sinks when you're ready to go deeper.

If you're building a library, the library support guide is where you'll want to start—it explains how to use LogTape in your own package without forcing configuration on your users. And if you're working with Express, Fastify, Hono, Koa, GraphQL Yoga, or Drizzle ORM, check the framework integrations docs to see what you get out of the box.

You can find the repository here: github.com/dahlia/logtape

Final Thoughts

LogTape is a thoughtful answer to a real problem: logging in libraries has always been awkward. If you're a library author who wants to log without stepping on your users' toes, or an application developer who wants a logger that works everywhere without a dependency tree, it's worth a look. The zero-dependency guarantee and broad runtime support make it a low-risk choice, and the built-in redaction is a feature more loggers should have. It's not flashy—it's just well-designed and practical.

Follow @githubprojects for more developer tools and open source projects.

Back to Projects
Project ID: ff5e3ee4-8eb8-462d-8a1b-b96fc8b92028Last updated: August 12, 2026 at 02:47 AM