Browser
Server
Native OpenTelemetry
Fullstack Frameworks
Overview
Self Host & Local Dev
Menu
Winston Quick Start
Learn how to set up highlight.io log ingestion for Winston JS.
1
Configure client-side Highlight. (optional)
If you're using Highlight on the frontend for your application, make sure you've initialized it correctly and followed the fullstack mapping guide.
2
Setup the Winston HTTP transport.
The Winston HTTP transport will send JSON logs to highlight.io
import {createLogger, format, transports} from 'winston';
const highlightTransport = new transports.Http({
host: 'pub.highlight.run',
path: "/v1/logs/json",
ssl: true,
headers: {
'x-highlight-project': '<YOUR_PROJECT_ID>',
'x-highlight-service': 'EXAMPLE_NODEJS_SERVICE',
},
})
export const logger = createLogger({
level: 'info',
format: format.combine(
format.json(),
format.errors({ stack: true }),
format.timestamp(),
format.prettyPrint(),
),
transports: [new transports.Console(), highlightTransport],
})
3
Verify your backend logs are being recorded.
Visit the highlight logs portal and check that backend logs are coming in.