Skip to content

Instantly share code, notes, and snippets.

@DonMartin76
Created December 28, 2017 14:57
Show Gist options
  • Save DonMartin76/71ea6d7fd1ee974809ade90304c494d3 to your computer and use it in GitHub Desktop.
Save DonMartin76/71ea6d7fd1ee974809ade90304c494d3 to your computer and use it in GitHub Desktop.
'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