Created
December 28, 2017 14:57
-
-
Save DonMartin76/71ea6d7fd1ee974809ade90304c494d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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