Skip to content
@loglayer

LogLayer

Home of the loglayer library, a modern logging library for Typescript and Javascript

LogLayer

A unified logging layer for TypeScript / JavaScript

NPM version NPM Downloads TypeScript Bundle size MIT License

DocumentationGetting StartedGitHub


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');

Highlights

  • 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

Ecosystem

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)

Get Started

npm install loglayer

Read the documentation or jump straight to the getting started guide.


Made with care by Theo Gravity. Logo by Akshaya Madhavan.

Popular repositories Loading

  1. loglayer loglayer Public

    A modern logging library for Javascript / Typescript that routes logs to various logging libraries, cloud providers, files, StatsD, and OpenTelemetry while providing a fluent API for specifying log…

    TypeScript 422 7

  2. loglayer-transport-boilerplate loglayer-transport-boilerplate Public template

    A template for creating transports for LogLayer

    TypeScript

  3. loglayer-plugin-boilerplate loglayer-plugin-boilerplate Public template

    A template for creating plugins for LogLayer

    TypeScript

  4. .github .github Public

Repositories

Showing 4 of 4 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…