Created
February 19, 2017 09:04
-
-
Save AngelMunoz/dec9505da729c6f8bcb4caeca629eea5 to your computer and use it in GitHub Desktop.
add a file logger in sails.js
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') | |
const customLogger = new (winston.Logger)({ | |
transports: [ | |
new (winston.transports.Console)({ | |
colorize: true, | |
level: 'silly', | |
json: false | |
}), | |
new (winston.transports.File)({ // add as many as you want | |
name: 'verbose-file', | |
filename: 'logs/verbose.log', | |
colorize: false, | |
level: 'verbose', // level of the log | |
json: false | |
}), | |
new (winston.transports.File)({ | |
name: 'errors-file', | |
filename: 'logs/error.log', | |
colorize: false, | |
level: 'error', | |
json: false | |
}) | |
] | |
}) | |
module.exports.log = { | |
custom: customLogger | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment