leg
logs of json
Overview
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.
Super Quickstart
var log = ; log;
Installation
Available via npm:
$ npm install leg
Or via git:
$ git clone git://github.com/deoxxa/leg.git node_modules/leg
API
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 = ;
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;
Arguments
- 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 (defaultnull
)
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!
loglogloglog
log;
Arguments
- text - same as
text
inlog
- info - same as
info
inlog
Creating your own
logsilly = log;log;
License
3-clause BSD. A copy is included with the source.
Contact
- GitHub (deoxxa)
- Twitter (@deoxxa)
- Email (deoxxa@fknsrs.biz)