Skip to content

Instantly share code, notes, and snippets.

@pjanuario
Last active February 5, 2016 09:31
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 pjanuario/c5889fc5f9160fab0d0b to your computer and use it in GitHub Desktop.
Save pjanuario/c5889fc5f9160fab0d0b to your computer and use it in GitHub Desktop.
This gist is logger facade console plugin nodejs usage sample
var Logger = require('logger-facade-nodejs');
var LoggerConsolePlugin = require('logger-facade-console-plugin-nodejs');
// this is the default config
var config = {
level: 'debug',
timeFormat: 'YYYY-MM-DD HH:mm:ss',
messageFormat: '%time | %logger::%level - %msg'
};
console.log("Start sample of Async Log...");
var plugin = new LoggerConsolePlugin(config);
Logger.use(plugin);
console.log("Plugins: ", Logger.plugins());
var log = Logger.getLogger("Name");
log.trace("Message to log %s and should be hide", 'with args');
log.debug("Message to log %s", 'with args');
log.info("Message to log %s", 'with args');
log.warn("Message to log %s", 'with args');
log.error("Message to log %s", 'with args');
console.log("End sample...");
process.nextTick(function(){
console.log("Start sample of Async Log and delay execution...");
log.info("Message to log %s", 'with args');
process.nextTick(function(){
console.log("End sample of delayed execution!");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment