Node

Lyrelog for Node

The same package as the browser, on your server: uncaught exceptions are kept on disk and sent when the process starts again, and a server key marks your events as verified.

import { Lyrelog } from "@lyrelog/js";

export const log = Lyrelog.init({
  // a server key, lyr_srv_..., kept on the server
  apiKey: process.env.LYRELOG_KEY!,
  platform: "api", // "node" unless you say
});

Version 1.0.0. Node 22.12 or later.

What it does on Node

Start it and these come with it. Where the platform can't tell by itself, it's a call or a few lines, all in the guide.

  • On its ownCrashes and uncaught errorsUncaught exceptions and rejections, sent on the next start
  • On its ownSessionsOne per process
  • On its ownEnvironment, told apartProduction when NODE_ENV=production, else development
  • A call or a few linesEvents wait when offlineIn memory, up to 10,000 events: flush before exiting
  • On its ownVerified eventsWith a server key
  • Not thereYour existing loggingNo pino or winston adapter: call the SDK

Node, in practice

What the guide says to keep in mind on this platform.

  • Serverless functions await log.flush() before returning.
  • Close the client on SIGTERM: process.exit() loses what's queued.
  • An Express error handler is a few lines: captureError with the route.
  • The Node guide

See it with your own app's events

Sign up with GitHub, Google or Apple. Your organization starts on Free; move it to Pro whenever you want.