Logging with Winston in Logtail

Install the @logtail/winston NPM package and set up the Logtail transport according to the following example

npm install @logtail/winston
npm install @logtail/node
const winston = require("winston");
const { Logtail } = require("@logtail/node");
const { LogtailTransport } = require("@logtail/winston");

// Create a Logtail client
const logtail = new Logtail("<source-token>");

// Create a Winston logger - passing in the Logtail transport
const logger = winston.createLogger({
  transports: [new LogtailTransport(logtail)],

// Log as normal in Winston - your logs will sync with Logtail.com!
  level: "info", // <-- will use Logtail's `info` log level,
  message: "Some message", // <-- will also be passed to Logtail

Don't forget to replace with your actual source token which you can find by going to your account -> sources -> edit.