Install the @logtail/pino npm package:
Set up the Pino logger with the Better Stack transport:
Use the Pino logger as usual:
You should see your logs in Better Stack β Live tail.
The @logtail/pino transport supports Pino v7 and above.
The Pino transport sends logs from a worker thread, which serverless platforms like AWS Lambda freeze as soon as your handler returns. Its last logs may never reach Better Stack.
In serverless functions, use LogtailStream instead and flush the logs before the handler returns:
LogtailStream requires @logtail/pino 0.5.12 or newer.
Please let us know at hello@betterstack.com.
We're happy to help! π
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.
We use cookies to authenticate users, improve the product user experience, and for personalized ads. Learn more.