How to add timestamp to file with Winston


How to add timestamp to file with Winston



I'm logging with Winston, and I am using the following code:


const logger = winston.createLogger({
level: 'info',
transports: [
//
// - Write to all logs with level `info` and below to `MyLog.log`
//
new winston.transports.File({
filename: 'MyLog.log',
format: winston.format.combine(
winston.format.timestamp({
format: 'YYYY-MM-DD hh:mm:ss A ZZ'
}),
winston.format.json()
),
handleExceptions: true
})
]
});



If I change the transport to Console it works like a champ.



What am I missing here?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

How to add background colour in existing image using Swift?

What's the difference between DDS and SOME/IP?

How to make file upload 'Required' in Contact Form 7?