maclogger
A very basic winston wrapper that duplicate the nodejs console essential API, aka log(), info(), warn(), error()
It is useful for injecting an application-specific logger into a generic function or module, for example
// A nodejs module
var logger = console
var myfunction(param1, optionalLogger) {
if (optionalLogger !== undefined) {
logger = optionalLogger
}
logger.log("Cool, now we are logging to the app-specific logger if it was passed as a parameter. Otherwise we're still logging to the console")
}
exports = myfunction
installation
npm install maclogger
usage
var logger = logger // Just logs to the consoleloggerlogger // Logs to the console and to myApp.loglogger // See winston for list of options https://github.com/winstonjs/winston#multiple-transports-of-the-same-typelogger // Logs to the console, to myApp.log - but not not to important.log (important.log will only log warnings and errors)