Installation

Install Pino using npm:
For OpenTelemetry support, also install:

Setup

Create a logger.js file

Create a logger.js file in your project root to centralize logger configuration:
This configuration:
  • Sends logs to stdout (console)
  • Routes logs to OpenTelemetry transport for integration with observability platforms
  • Sets log level to “trace” to capture all events

Import and use in your app

In your main app.js, import the logger:
Then use it throughout your application:

Log Levels

Pino supports the following log levels (in order of severity):
  • fatal - Application is unusable
  • error - Error condition
  • warn - Warning condition
  • info - Informational message
  • debug - Debug message
  • trace - Trace message (most verbose)

Learn More

For detailed documentation, visit the Pino npm package.