mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
[DEBUG] Trace only those events which have listeners. (#201)
The `DEBUG=*page npm run unit` is too verbose due to events spamming the console. This patch starts tracing emitted events only if there are any listeners.
This commit is contained in:
parent
d8dd6ea140
commit
20ba447689
@ -145,7 +145,7 @@ class Helper {
|
||||
const method = Reflect.get(classType.prototype, 'emit');
|
||||
Reflect.set(classType.prototype, 'emit', function(event, ...args) {
|
||||
let argsText = [JSON.stringify(event)].concat(args.map(stringifyArgument)).join(', ');
|
||||
if (debug.enabled)
|
||||
if (debug.enabled && this.listenerCount(event))
|
||||
debug(`${className}.emit(${argsText})`);
|
||||
if (apiCoverage && this.listenerCount(event))
|
||||
apiCoverage.set(`${className}.emit(${JSON.stringify(event)})`, true);
|
||||
|
Loading…
Reference in New Issue
Block a user