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 = ;log;
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 = ;// instantiate with different outputvar log = ;// instantiate with optionsvar log = ;
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.
// log without any context information;// log with some useful context data;
- level - the coarse level of the log message. e.g. "ERROR"
- text - the main text body of the message. e.g. "received request"
- info - any kind of
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!
- text - same as
- info - same as
Creating your own
logsilly = log;log;
3-clause BSD. A copy is included with the source.