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.