A zero-configuration build tool for the web that bundles HTML, CSS, JavaScript and assets without a config file.
fullstack-build/tslog
Universal TypeScript and JavaScript logger with pretty terminal output, structured fields-first JSON, secret masking and zero runtime dependencies.
- Stars
- 1,750
- Forks
- 74
- Open issues
- 2
- Last commit
- 15 hours ago
What is it?
tslog is a logging library for TypeScript and JavaScript that runs on Node.js, browsers, Deno, Bun, workers and React Native with one API. By default it prints colorized, readable output in an interactive terminal and plain text when output is piped or run in CI, while a flat, fields-first JSON format can be enabled for production log pipelines.
The library covers common needs such as log levels with custom level support, child loggers that inherit settings and bound fields, and masking of keys, paths and regex matches so secrets do not reach log output. Errors and stack traces are formatted and serializable, and source maps map positions back to original TypeScript files on Node, Bun and Deno.
For output routing, tslog offers transports for files, HTTP endpoints, in-memory ring buffers and worker threads, plus presets that emit pino-compatible or OpenTelemetry OTLP/JSON output. Its core package has zero runtime dependencies, and a slim subpath is available for size-sensitive browser bundles.
Key features
- 01Same API across Node.js, browsers, Deno, Bun, workers and React Native
- 02Pretty output colored in terminals and plain when piped, with optional JSON
- 03Secret masking by key name, JSON path, regex or hashed placeholder
- 04Child loggers that inherit settings and bound fields
- 05Pluggable transports for files, HTTP, ring buffers and worker threads
- 06Zero runtime dependencies and TypeScript types
Use cases
- Adding consistent logging to a Node.js service with JSON output in production
- Logging from a shared module that runs in both browser and server code
- Masking passwords and tokens before logs leave the process
- Shipping logs to a file, HTTP collector or OpenTelemetry endpoint
Quick start
- 1
Install tslog from npm
npm install tslog - 2
Import Logger and log a message
Things to know
- Requires Node.js 22 or newer and is ESM-only, with no CommonJS require() support.
- Version 5 is a breaking redesign, so upgrading from v4 needs code changes.
Topics
FAQ
- What is tslog?
- Universal TypeScript and JavaScript logger with pretty terminal output, structured fields-first JSON, secret masking and zero runtime dependencies. tslog is a logging library for TypeScript and JavaScript that runs on Node.js, browsers, Deno, Bun, workers and React Native with one API. By default it prints colorized, readable output in an interactive terminal and plain text when output is piped or run in CI, while a flat, fields-first JSON format can be enabled for production log pipelines.
- Is tslog free to use? What license does it have?
- tslog is open source under the MIT license. Check the license terms before using it in commercial products.
- Is tslog still maintained?
- Actively maintained. The last commit to tslog was on Oct 20, 2026.
- What can I use tslog for?
- Adding consistent logging to a Node.js service with JSON output in production Logging from a shared module that runs in both browser and server code Masking passwords and tokens before logs leave the process Shipping logs to a file, HTTP collector or OpenTelemetry endpoint
- How do I install tslog?
- Install tslog from npm: npm install tslog Import Logger and log a message
- Where can I get tslog?
- The source code and installation instructions are on GitHub: https://github.com/fullstack-build/tslog
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A VSCode extension that reformats TypeScript error messages into readable, syntax-highlighted types with links to docs and explanations.
A scripting solution that lets Unity and Unreal Engine games be written in TypeScript/JavaScript, with Lua and Python backends for Unity.
Ultra-low-latency asynchronous C++17 logging and metrics library that defers formatting and I/O to a background thread.
Open source React and Svelte libraries for building interactive node-based UIs such as flowcharts, graphs and workflow editors.
A Go framework for building cross-platform desktop apps with a web frontend (React, Vue, Svelte, etc.) using native rendering engines.