npm install stoopid
Or from source:
git clone git://github.com/mikeal/stoopid.git cd stoopid npm link
stoopid.log('I am a robot', {prop:'value'})
The stoopid module exports itself as an instance of Logger
with the namespace "process"
.
You can create child logger objects with new namespaces with the .logger(name)
method.
var logger = require('stoopid').logger('myModuleName')
A logger object supports all the same methods that the console
object in node supports and has a nearly identical API. It also supports all the methods necessary to be enabled as a logger in socket.io
.
console logging is enabled by default.
Base logger object.
- Logger.logger(name) - Create a new instance of logger with this logger as it's parent.
- Logger.addHandler(handler, options) - Add a handler,
"console"
and"file"
are supported. - Logger.silly(arg1, arg2, ...) - Logs at level
"silly"
or10
- Logger.verbose(arg1, arg2, ...): - Logs at level
"verbose"
or100
- Logger.debug(arg1, arg2, ...): - Logs at level
"info"
or200
- Logger.info(arg1, arg2, ...): - Logs at level
"info"
or300
- Logger.warn(arg1, arg2, ...): - Logs at level
"warn"
or400
- Logger.error(arg1, arg2, ...): - Logs at level
"error"
or500
All the additional methods necessary to be used as a replacement for node.js' global console object are also supported.
- Logger.log(arg1, arg2, ...) - Logs at level
"info"
or300
. - Logger.dir(arg1, arg2, ...) - Logs at level
"info"
or300
. - Logger.time(label) - Mark a timer. http://nodejs.org/api/stdio.html#console.time
- Logger.timeEnd(label) - Finish timer, record output. http://nodejs.org/api/stdio.html#console.timeEnd
- Logger.trace(label) - Log at
"error"
level a stack trace to stderr in the current position. http://nodejs.org/api/stdio.html#console.trace - Logger.assert(expression) - http://nodejs.org/api/stdio.html#console.assert