mirror of
https://github.com/mathew-kurian/Scribe.js
synced 2025-04-25 14:55:01 +00:00
Handle the 'error' event case
This commit is contained in:
parent
a9f9dd61c0
commit
cd4d49c6b4
1 changed files with 13 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue