Created
February 5, 2016 09:32
-
-
Save pjanuario/238a8b0819cf390779f2 to your computer and use it in GitHub Desktop.
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', | |
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