mirror of
https://github.com/mathew-kurian/Scribe.js
synced 2025-04-25 06:45:10 +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;
|
log.message = log.contextString + offsetSpace + log.argsString;
|
||||||
|
|
||||||
//Emit events
|
//Emit events
|
||||||
this.emit('new', log, log.type);
|
this.emit('new', log, log.type); //'new' event
|
||||||
this.emit(log.type, log);
|
|
||||||
|
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
|
//If the logger should print the message
|
||||||
//Print it
|
//Print it
|
||||||
|
|
Loading…
Add table
Reference in a new issue