new CustomFunction(opts)
CustomFunction - A logging transport implementation executing a given function.
Parameters:
Name | Type | Description |
---|---|---|
opts |
object | (optional) - An object, holding configuration values for the Console transport. The only valid key is a 'function', which is executed on log events. |
- Source:
Example
var clogger = require('node-clogger');
var logger = new clogger.CLogger().addTransport(new clogger.transports.CustomFunction({
'function': function(args) {
console.log('%s|%s|%s|%s', new Date(args.timestamp).toString(), args.id, args.level, args.message);
}
});
logger.debug('%sl%s', 'd', 'c');