Skip to content

Instantly share code, notes, and snippets.

@bennycode
Created March 20, 2017 14:06
Show Gist options
  • Save bennycode/28b2d6d986668443aacef1a397fc8b4e to your computer and use it in GitHub Desktop.
Save bennycode/28b2d6d986668443aacef1a397fc8b4e to your computer and use it in GitHub Desktop.
Using "winston"
const winston = require('winston'); // v2.3.1
winston.configure({
transports: [
new (winston.transports.File)({
filename: './data/test.txt',
handleExceptions: true,
json: false,
level: 'silly',
maxFiles: 5,
maxsize: 5242880, // 5 MB
formatter: function(options) {
return options.message;
}
})
]
});
winston.log('silly', 'Hello, World!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment