A modern logging library for TypeScript with custom levels, worker-thread offloading, fully customizable templates, and built-in transports featuring file rotation, retention, batching, compression, HTTP authentication (OAuth2, Basic, ...) and more.
-
✅ Type‑Safe & Structured
Every entry is a plain object (msg
,level
,time
,meta
), giving you compile‑time guarantees and smooth downstream processing. -
🔌 Pluggable Transports
Console, File (rotation, batching, retries), HTTP (OAuth2, Bearer, API‑Key) or roll your own by extendingTransport
. -
🎨 Rich Formatting
JSON‑array, NDJSON, envelope or fully‑templated text: padding, truncation, colors, emojis, custom hooks. -
🐞 Robust Error Serialization
TurnError
, nestedcause
chains, andAggregateError
into safe, circular‑free JSON with optional stacks & hooks. -
⚙️ Fine‑Grained Control
Filters, transformers, custom level maps, categories, gzip, merge‑meta—everything you need to tailor your pipeline. -
🧵 Worker‑Thread Offloading
Push transport specific tasks to background threads so your main loop stays rock‑solid.
npm install logpot
# or
yarn add logpot
import { createLogger, getLogger } from 'logpot'
// 1️⃣ Initialize
await createLogger()
// 2️⃣ Use it
const logger = getLogger()
logger.info('Server started', { port: 8080 })
logger.error(new Error('Database connection failed'))
// 3️⃣ Graceful shutdown
await logger.close()
- Site & Guides: https://tenray.io/logpot
- API Reference: https://tenray.io/logpot/reference
- GitHub: https://github.com/koculu/logpot
- Discussions & Support: https://github.com/koculu/logpot/discussions
Funding open-source helps us maintain and improve LogPot. If you find LogPot valuable, please consider sponsoring its development:
- GitHub Sponsors:
https://github.com/sponsors/koculu
Your support keeps the library up‑to‑date, secure, and feature‑rich for everyone!
We welcome issues, PRs, and feature requests! Please see CONTRIBUTING.md for guidelines.
Released under the MIT License.