emit-logger

0.1.0 • Public • Published

emit-logger

Event logger for EventEmitter.

Installation

npm:

$ npm install emit-logger

Usage

Example:

var Emitter = require('events').EventEmitter;
var EmitLogger = require('emit-logger');
var logger = new EmitLogger();
 
var emitter1 = new Emitter();
emitter1.toString = function() {
  return 'emitter 1';
};
 
var emitter2 = new Emitter();
emitter2.toString = function() {
  return 'emitter 2';
};
 
logger.add(emitter1);
logger.add(emitter2);
 
emitter1.on('foo', function() {
  console.log('foo!');
});
 
emitter1.emit('foo', 'hello', 'world');
 
setInterval(function() {
  emitter2.emit('random', Math.random());
}, 500);

screenshot

License

The MIT License

Copyright (c) 2013 Circuit Lab. <info@uniba.jp>

Keywords

none

install

npm i emit-logger

Downloadsweekly downloads

9

version

0.1.0

license

none

last publish

collaborators

  • avatar
Report a vulnerability