Backend: Error Monitoring
Go
JS
Python
Ruby
Backend: Logging
Fullstack Frameworks
Next.JS
Self Host & Local Dev
Menu
Logging in Winston
Learn how to set up highlight.io log ingestion for Winston JS.
1
Set up your frontend highlight.io integration.
First, make sure you've followed the frontend getting started guide.
2
Setup the Winston HTTP transport.
The Winston HTTP transport will send JSON logs to highlight.io
import winston from 'winston'
const highlightTransport = new winston.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 = winston.createLogger({
level: 'info',
format: winston.format.combine(
winston.format.json(),
winston.format.errors({ stack: true }),
winston.format.timestamp(),
winston.format.prettyPrint(),
),
transports: [new winston.transports.Console(), highlightTransport],
})3
Verify your backend logs are being recorded.
Visit the highlight logs portal and check that backend logs are coming in.