diff --git a/lib/console2.js b/lib/console2.js index 4227a55..3e2cd96 100644 --- a/lib/console2.js +++ b/lib/console2.js @@ -572,8 +572,19 @@ log.message = log.contextString + offsetSpace + log.argsString; //Emit events - this.emit('new', log, log.type); - this.emit(log.type, log); + this.emit('new', log, log.type); //'new' event + + var msg = log.type; + + /* + * EventEmitter.emit() will raise an Error + * if we emit the event 'error' and their is no listeners + * For now, transform 'error' in 'errorEvent' + */ + if (msg === 'error') { + msg += 'Event'; + } + this.emit(msg, log); //`log.type` event //If the logger should print the message //Print it