Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save pjanuario/238a8b0819cf390779f2 to your computer and use it in GitHub Desktop.
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',
json: true
};
console.log("Start sample of Async Log IN JSON...");
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... Yes, you see this first because the log write is set to next process instruction. :D");
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