json logging to stdout

npm install logged
7 downloads in the last day
26 downloads in the last week
36 downloads in the last month
# logged
Logging should be simple. This library is 80 lines of code. It gets the job done. Simply.

## examples

### simple

var log = require('logged')();

What you should see on stderr: `{"level":0,"message":"test","date":"2012-04-21T09:37:47.373Z"}`

### named logger

var log = require('logged')('my-logger');

What you should see on stderr: `{"level":0,"message":"test","name":"my-logger","date":"2012-04-21T09:37:47.373Z"}`

### log with more context

var log = require('logged')({name: 'my-logger', env: 'production'});
log.debug('test', {user: 'joe'});

What you should see on stderr: `{"level":0,"message":"test","name":"my-logger","date":"2012-04-21T09:37:47.373Z","env":"production","user":"joe"}`

## customizable

### change the log levels
//before requiring anything else from logged
var levels = require('logged/levels');
levels.trace = 0;
levels.debug = 1;
levels.awesome = 2;
levels.chainsaw = 3;
levels.boom = 4;

var log = require('logged')();

### change how the log is output
var logged = require('logged');
//if you handle the log event yourself
//logged will do no outputting to stderr
//this lets you effectively do anything you want
//with the log messages
logged.on('log', function(logMessage) {
  //pg.query('INSERT INTO log(level, message) VALUES(level, message)');
  if(logMessage.level > 10) {
    email.send('errors@yourcompany.com', JSON.stringify(logMessage));
npm loves you