logwrangler is a module logging system that you can easily extend to add various logging locations and functions.
Install
npm install --save logwrangler
Use
Logging to stdout
var logwrangler = require('../index');
var logger = logwrangler.create();
logger.log({
level: logger.levels.INFO,
ns: 'web server',
message: 'some log message',
data: {}
});
Custom logging handler
var logger = fancyLog.create({
level: fancyLog.levels.DEBUG, // default level to log
outputs: {
custom: {
enabled: true,
handler: function(options, data){
/*
options = {
level: <default log level, string>
};
data = {
level: <log level>,
ns: <namespace, string>,
ident: <custom identifier, string>,
message: <message, string>,
data: <custom data, object>
};
*/
// do something with your data
}
}
}
});