Documentation • Getting Started • GitHub
LogLayer provides a fluent, structured logging API that sits on top of your logging library of choice. Fan out logs to multiple destinations at the same time — start with console, then add Pino, Datadog, or any combination of transports without changing your application code.
import { LogLayer } from 'loglayer';
import { PinoTransport } from '@loglayer/transport-pino';
import { DatadogTransport } from '@loglayer/transport-datadog';
import pino from 'pino';
const log = new LogLayer({
// Send logs to multiple destinations at the same time
transport: [
new PinoTransport({ logger: pino() }),
new DatadogTransport({
apiKey: process.env.DD_API_KEY,
service: 'my-app',
}),
],
});
log.withContext({ requestId: 'abc-123' })
.withMetadata({ duration: 150 })
.withError(new Error('Timeout'))
.error('Request failed');- Bring your own logger — works with Pino, Winston, Bunyan, tslog, Consola, and more
- Multi-transport — send logs to multiple destinations simultaneously (e.g. Pino + Datadog)
- Cloud-native — transports for Datadog, AWS CloudWatch, Google Cloud, New Relic, Sentry, Axiom, Better Stack, and others
- Extensible — plugins for redaction, filtering, OpenTelemetry trace injection, and sprintf formatting
- Framework integrations — first-class support for Hono, Fastify, and ElysiaJS
- Multi-platform — runs on Node.js, Deno, Bun, and browsers
- Tiny footprint — 8kB gzipped core, most transports under 1kB
- Battle tested — in production for 4+ years at Airtop.ai
| Packages | |
|---|---|
| Logging Libraries | Pino, Winston, Bunyan, Consola, tslog, Log4js, Roarr, Signale, loglevel, LogTape, Tracer, Electron-log |
| Cloud Providers | Datadog, AWS CloudWatch, AWS Lambda Powertools, Google Cloud, New Relic, Sentry, Axiom, Better Stack, Dynatrace, Sumo Logic, Logflare, VictoriaLogs |
| Other Transports | HTTP, Log File Rotation, OpenTelemetry, Pretty Terminal, Simple Pretty Terminal |
| Plugins | Redaction, Filter, OpenTelemetry, Datadog APM Trace Injector, Sprintf |
| Integrations | Hono, Fastify, ElysiaJS |
| Mixins | Hot-Shots (StatsD), Datadog Metrics (HTTP) |
npm install loglayerRead the documentation or jump straight to the getting started guide.
Made with care by Theo Gravity. Logo by Akshaya Madhavan.
