Skip to content

Instantly share code, notes, and snippets.

@AngelMunoz
Created February 19, 2017 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AngelMunoz/dec9505da729c6f8bcb4caeca629eea5 to your computer and use it in GitHub Desktop.
Save AngelMunoz/dec9505da729c6f8bcb4caeca629eea5 to your computer and use it in GitHub Desktop.
add a file logger in sails.js
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