Created
March 20, 2017 14:06
-
-
Save bennycode/28b2d6d986668443aacef1a397fc8b4e to your computer and use it in GitHub Desktop.
Using "winston"
This file contains 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
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