-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
misc(logger): add time/timeEnd methods #5905
Conversation
@@ -6,6 +6,8 @@ | |||
'use strict'; | |||
|
|||
const debug = require('debug'); | |||
const marky = require('marky'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit and some bike shedding, but otherwise LGTM. Thanks for splitting this off!
lighthouse-logger/index.js
Outdated
|
||
static timeEnd({msg, id, args=[]}, level='verbose') { | ||
Log[level]('statusEnd', msg, ...args); | ||
return marky.stop(id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this going to be used? Should update lighthouse-logger/index.d.ts
or drop the return
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
lighthouse-logger/index.js
Outdated
@@ -207,5 +219,10 @@ class Log { | |||
} | |||
|
|||
Log.events = new Emitter(); | |||
Log.getEntries = _ => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this (appears) to be going for the same getEntries()
name as the Performance.getEntries()
, but it's definitely confusing in the context of a logger (where you might expect it to return all log entries).
WDYT about Log.getTimeEntries()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same feeling as well, will do 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
settled on takeTimeEntries to mimic the semantics and name of PerfObserver 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
lighthouse-logger/index.js
Outdated
@@ -207,5 +219,10 @@ class Log { | |||
} | |||
|
|||
Log.events = new Emitter(); | |||
Log.getEntries = _ => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe make this a getter instead of a function. No big deal though
|
In order to land #3745, we need logger to be published with the new functionality. This is just the
lighthouse-logger
portion of #3745 with a version bump to1.1.0