Thinnest possible logging
console.error is really enough and the world has
too many log frameworks. This library should not be used, but if you
decide to anyway, you get the following:
The default log level is
INFO. Debug messages are not shown. Info,
warnings and errors are.
INFO go to
console.log (and thus
ERROR go to
*** 1.0.0 - changed to local time zone. Earlier versions times were always in Zulu.
The default time format is ISO8601 in the local time zone.
npm install bog
var log = require'bog';log.info'Something wonderful has happened Your AMIGA is alive !!!';
2013-06-13 19:05:35.482 INFO Something wonderful has happened Your AMIGA is alive !!!
Outputs logging at the
args is one or many arguments
which is passed to the output function.
log.info'and, even' 'better...';
2013-06-13 19:05:35.482 INFO and even better...
N.b. The above is conceptually the same as
console.logtoISOString 'INFO' 'and, even' 'better...';
log.info, but to
log.info, but to
Sets the lowest reported log level, for example
warn would enable
error, and disable
out is the output function for
err is the
output function for
null is appropriate to
turn off output.
logredirectnull null; // silences all logginglogredirectconsole.log console.error; // reinstates defaults
Spills the beans of the internal config. Can be used to alter the formatting.
logconfigif level === 'info'argsunshift'Prepended';argspush'Appended';return args;;
*** Since 1.0.0
It's possible to turn on the time designator and timezone.
logconfigincludeTimeDesignator = true;logconfigincludeTimeZone = true;log.info'Something wonderful has happened Your AMIGA is alive !!!';
If machine timezone is India this would produce:
2013-06-13T19:05:35.482+0530 INFO Something wonderful has happened Your AMIGA is alive !!!
Notice that zulu (GMT) time is denoted by a 'Z'.
MIT License (MIT).