Last active
February 5, 2016 09:31
-
-
Save pjanuario/c5889fc5f9160fab0d0b to your computer and use it in GitHub Desktop.
This gist is logger facade console plugin nodejs usage sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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