0.0.9 • Published 9 years ago

maclogger v0.0.9

Weekly downloads
4
License
UNLICENSED
Repository
github
Last release
9 years ago

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 = require("maclogger")


logger.log("blah")	// Just logs to the console
logger.addLogFile("~/logs/myApp.log")
logger.log("blah")	// Logs to the console and to myApp.log
logger.addLogFile({filename: "~/logs/important.log", level: "warn"}) // See winston for list of options https://github.com/winstonjs/winston#multiple-transports-of-the-same-type
logger.log("blah")	// Logs to the console, to myApp.log - but not not to important.log (important.log will only log warnings and errors)
0.0.9

9 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago