Created
May 16, 2015 02:25
-
-
Save barretts/ae7fff301168ef623611 to your computer and use it in GitHub Desktop.
Sails.js configuration to use Winston logger output to file
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
var winston = require('winston'); | |
/* | |
Sails.js Winston logger config | |
I was having trouble getting the logfile output to be verbose, having copied several from the web I finally came | |
up with this setup after reading the old Captian's Log configuration. Current problem is the doubling of verbose. | |
ex: verbose: verbose: Grunt :: Running "sails-linker:devStyles" (sails-linker) task | |
*/ | |
var logger = new (winston.Logger)({ | |
transports: [ | |
new (winston.transports.Console)( { | |
level: 'verbose', | |
colorize: false, | |
json: false | |
} ), | |
new (winston.transports.File)({ | |
filename: 'logfile.log', | |
level: 'verbose', | |
colorize: false, | |
json: false | |
}) | |
] | |
}); | |
module.exports.log = { | |
/*************************************************************************** | |
* * | |
* Valid `level` configs: i.e. the minimum log level to capture with * | |
* sails.log.*() * | |
* * | |
* The order of precedence for log levels from lowest to highest is: * | |
* silly, verbose, info, debug, warn, error * | |
* * | |
* You may also set the level to "silent" to suppress all logs. * | |
* * | |
***************************************************************************/ | |
level: 'verbose', | |
colorize: false, | |
json: false, | |
custom: logger | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looking for an example on how to configure winston with sails i found this very helpful!
As for the double of the level, wouldn't adding this
showLevel:false
solve the problem?