event.log

use node event to console the log error etc.

Event.log

Event.log allow u to log info by node event.

--

Install

npm install event.log

--

Usage

Just like js console.

{
    var console = require('event.log')
    console.on('console.log', function(data) {
        // do something
    })
    console.log(//do something)
}

Event.log will check the env.NODE_ENV with the code blow:

function isDev() {
    return process.env.DEBUG || (process.env.NODE_ENV === 'test') || (process.env.NODE_ENV === 'dev') || (process.env.NODE_ENV === 'development') || (process.env.NODE_ENV === 'debug') || (process.env.NODE_ENV === 'DEBUG') || false;
}

If in dev mode will show the message on the Terminal currently. If not dev mode will send the message by the event.

The event response message is like this:

{
    type: 'log',
    signature: 1374825996803,
    message: 'test'
}

--

API

Will print the log message. the log event is console.log.

Will print the error message. the error event is console.error.

Will print the warn message. the warn event is console.warn.

Will print the trace the trace event is console.trace.

Will print the raw data. the raw event is console.raw.

License

MIT

Copyright [2013] [xeodou@gmail.com]