Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
'use strict'
// This is for winston < 3.0.0 (e.g. 2.4.0), unfortunately works
// differently in winston 3.0.0+
const winston = require('winston');
const logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({
timestamp: function () {
return (new Date()).toISOString();
},
json: true,
// This makes sure each log entry is single line
stringify: (obj) => JSON.stringify(obj)
})
]
});
module.exports = logger;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.