lig leg log
logs of json
leg! leg because lel! leg is a stupidly simple JSON-based logging thingy. It works the way I want it to, and you might also garner some utility from it. If not, that's fine.
var log = require"leg";log.info"something happened!" some: "other" things: "here";
Available via npm:
$ npm install leg
Or via git:
$ git clone git://github.com/deoxxa/leg.git node_modules/leg
Creates a new logging function thing. Optionally takes a writable stream to
output to as an argument. By default, will use
process.stderr. The return
value is a function that you can use to log things!
// instantiate with default process.stderr outputvar log = leg;// instantiate with different outputvar log = logprocessstdout;// instantiate with optionsvar log = lognull object: true;
This is the return value of
leg(). It takes three arguments, with the last one
being optional. It also has a few convenience things tacked onto it, read on
below for more info on them.
loglevel text info;
// log without any context informationlog"EMERGENCY" "there are very few donuts left";// log with some useful context datalog"EMERGENCY" "there are very few donuts left" donutCount: 3;
JSON.stringify-able value (default
debug info warn error
These are all properties of the
log function. They just provide a suggested
set of log levels. You can even create your own!
logdebugtext infolog.infotext infolog.warntext infolog.errortext info
logdebug"some debugging info" someMetric: 12345;
Creating your own
logsilly = logbindlog "SILLY";logsilly"yippee" woo: "hoo";
3-clause BSD. A copy is included with the source.