Better Stack Pino transport

Start logging in 3 steps

1. Install

Install Logtail Pino NPM package:

Install Logtail Pino
npm install @logtail/pino

2. Setup

Set up Pino logger with Logtail transport:

Set up Pino logger
const token = '$SOURCE_TOKEN'; 
const pino = require('pino');
const transport = pino.transport({
  target: "@logtail/pino",
  options: { sourceToken: token }
});
const logger = pino(transport);

3. Start logging ๐ŸŽ‰

Use Pino logger as usual:

Send logs to Logtail
logger.error("Something bad happened.");
logger.info({
    item: "Orange Soda",
    price: 100.00
}, "Log message with structured logging. ->");

You should see your logs in Logtail -> Live tail.

Pino version 7.0.0 or higher is required.
Logtail Pino client supports Pino v7+ transports.

Need help?

Please let us know at hello@betterstack.com.
We're happy to help! ๐Ÿ™

Additional resources

Want to learn more about Pino log levels and adding contextual data to your logs?
Check out our Complete Guide to Pino Logging in Node.js.