Send eel logs to a writable stream

eel-stream - EventEmitter logging -> writeable streams

An incredibly simple module, just 6 lines:

module.exports = function (formatterstream) {
    return function (entry) {
        var output = formatter(entry)
        if (!output) return
        stream.write(output + '\n')

Install it like this:

npm install eel-stream

Use it like this:

fs  = require('fs')
log = require('eel')
log.on('entry', require('eel-stream')(JSON.stringify, fs.createWriteStream(__dirname+'/myapp.log')))
log('test1', {ok: true})
log('test2', {ok: false})

And get log entries like this:

  • formatter: A callback with the signature (entry) -> String|Buffer
  • stream: A writable stream