DEV.co
Open-Source Observability · fullstack-build

tslog

tslog is a TypeScript/JavaScript logging library offering pretty console output for development and structured JSON for production. It supports multiple runtimes (Node.js, browsers, Deno, Bun), provides stack trace mapping via source maps, and includes features like secret masking and sub-logger inheritance.

Source: GitHub — github.com/fullstack-build/tslog
1.6k
GitHub stars
73
Forks
TypeScript
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryfullstack-build/tslog
Ownerfullstack-build
Primary languageTypeScript
LicenseMIT — OSI-approved
Stars1.6k
Forks73
Open issues13
Latest releasev4.11.0 (2026-07-07)
Last updated2026-07-07
Sourcehttps://github.com/fullstack-build/tslog

What tslog is

Universal logger with dual output modes (pretty formatting or JSON), native TypeScript support with source map integration, pluggable transport architecture, circular structure handling, and configurable log levels. Distributed as ESM and CommonJS with tree-shaking support.

Quickstart

Get the tslog source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/fullstack-build/tslog.gitcd tslog# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Development debugging with readable output

Use pretty-print mode locally to quickly identify issues with colorized, formatted logs that show stack traces and object structures clearly.

Production observability pipelines

Export structured JSON logs to centralized log aggregation services (ELK, Datadog, etc.) with context preservation and metadata injection.

Multi-environment TypeScript applications

Single logger abstraction across browsers, Node.js, Deno, and Bun with automatic source map lookup for accurate file/line references.

Implementation considerations

  • Enable source maps explicitly in tsconfig.json (inlineSourceMap or separate maps) and Node.js runtime (--enable-source-maps flag) for accurate stack trace attribution.
  • Secret masking via maskValuesOfKeys is recursive but operates at runtime; validate performance on deeply nested or large objects in production.
  • Sub-logger inheritance chains settings and fields; trace parent-child logger relationships to avoid unexpected log duplication or filtering.
  • Custom transport implementation requires understanding the lifecycle (mask → toLogObj → addMeta → format → transport); ensure error handling in transports does not block main application.
  • ESM vs. CommonJS entry points exist; align module strategy with application bundler and ensure correct import paths for tree-shaking benefits.

When to avoid it — and what to weigh

  • High-volume, ultra-low-latency logging required — No performance benchmarks provided; impact of masking, formatting, and transports at extreme scale is unknown.
  • Specialized logging domains (e.g., security audit logs) — Library lacks built-in features for immutable logging, log signing, or compliance-specific output formats.
  • Minimal bundle size is critical — No tree-shaking analysis or bundle-size metrics provided; actual footprint in browser contexts unclear.
  • Existing heavy logging infrastructure dependency — Transport layer is extensible but requires custom integration code; no pre-built connectors to enterprise logging platforms documented.

License & commercial use

MIT License. Permissive OSI-approved license allowing unrestricted commercial use, modification, and distribution with attribution and no warranty.

MIT license explicitly permits commercial use without restriction. Attribution required. No license revenue or support service terms stated in provided data; assume community-supported unless sponsor/enterprise arrangements are separately negotiated.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitStrong
Assessment confidenceHigh
Security considerations

Secret masking via maskValuesOfKeys mitigates accidental credential leakage; validate that masked keys cover all sensitive fields in your application. JSON output is unencrypted; secure log transmission and storage separately. No cryptographic audit, penetration test results, or known vulnerability history provided in data.

Alternatives to consider

Pino

Focused JSON logging for Node.js with stronger performance benchmarks and pre-built transports; tslog offers multi-runtime flexibility and pretty-print convenience instead.

Winston

Mature, widely-adopted Node.js logger with extensive ecosystem and commercial support options; tslog is lighter-weight and TypeScript-first with browser/Deno support.

Bunyan

JSON-first structured logging with strong operational conventions; tslog adds pretty formatting and universal runtime support at the cost of smaller ecosystem.

Software development agency

Build on tslog with DEV.co software developers

tslog provides a single, flexible logging abstraction across all your runtimes. Start with npm install tslog and review the GitHub repository for advanced configuration and transport integration.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

tslog FAQ

Does tslog support tree-shaking in browsers?
Yes, ESM distribution with tree-shaking support is stated. Actual bundle-size reduction depends on bundler configuration and unused code elimination; measure in your specific build.
Can I use tslog in both Node.js and browser in the same codebase?
Yes, tslog is universal. Ensure correct module resolution (ESM vs. CJS) per runtime. Instance name capture is server-side only; that feature will not execute in browsers.
How do I integrate tslog with external logging services (Datadog, Sentry)?
Implement a custom transport by attaching to attachedTransports in configuration. No pre-built connectors are documented; consult GitHub issues or community examples.
What is the performance impact of secret masking?
Masking is recursive and operates at runtime. No benchmarks provided; test with your log volume and object depth to validate acceptable latency before production.

Software developers & web developers for hire

Need help beyond evaluating tslog? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and open-source observability integrations — and maintain them long-term.

Ready to streamline logging in your TypeScript application?

tslog provides a single, flexible logging abstraction across all your runtimes. Start with npm install tslog and review the GitHub repository for advanced configuration and transport integration.