0.0.9 • Published 7 years ago

maclogger v0.0.9

Weekly downloads
4
License
UNLICENSED
Repository
github
Last release
7 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

7 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago