-
Notifications
You must be signed in to change notification settings - Fork 70
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
Specify console.timeLog() + clean up timing #138
Conversation
index.bs
Outdated
|
||
<p class="note">See <a href="https://github.com/whatwg/console/issues/134">whatwg/console#134</a> | ||
for plans to make {{console/timeEnd()}} and {{console/timeLog()}} formally report warnings to the | ||
console when a give |label| does not exist in the associated <a>timer table</a>. |
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.
A small typo here, the word "given" is misspelled. This looks good otherwise :)
index.bs
Outdated
associated <a>timer table</a>. | ||
1. Let |timerTable| be the associated <a>timer table</a>. | ||
1. Let |startTime| be |timerTable|[|label|]. | ||
1. [=map/set|Remove=] |timerTable|[|label|]. |
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.
This should probably map/remove
but I have to take a closer look
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.
You should be able to just do [=map/Remove=]
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 with nits, fun stuff
index.bs
Outdated
associated <a>timer table</a>. | ||
1. Let |timerTable| be the associated <a>timer table</a>. | ||
1. Let |startTime| be |timerTable|[|label|]. | ||
1. [=map/set|Remove=] |timerTable|[|label|]. |
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.
You should be able to just do [=map/Remove=]
index.bs
Outdated
@@ -389,7 +423,7 @@ their output similarly, in four broad categories. This table summarizes these co | |||
<td>log</td> | |||
<td> | |||
{{console/log()}}, {{console/trace()}}, {{console/dir()}}, {{console/dirxml()}}, | |||
{{console/group()}}, {{console/groupCollapsed()}}, {{console/debug()}} | |||
{{console/group()}}, {{console/groupCollapsed()}}, {{console/debug()}} {{console/timeLog()}} |
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.
Missing comma
index.bs
Outdated
1. Perform <a abstract-op>Logger</a>("timeEnd", « |concat| »). | ||
1. Perform <a abstract-op>Printer</a>("timeEnd", « |concat| »). | ||
|
||
<h4 id="timelog" method for="console">timeLog(|label|, ...|data|)</h4> |
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 wonder if putting "log" between time
("start") and "end" might make be nicer?
a60c63e
to
c7745ce
Compare
Rebased this as well. Will get moving on bugs + tests. |
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.
Some small comments, but this looks good to me
index.bs
Outdated
1. Let |startTime| be |timerTable|[|label|]. | ||
1. Let |duration| be a string representing the difference between the current time and | ||
|startTime|, in an implementation-defined format. | ||
1. Let |concat| be the concatenation of |label|, U+003A (:), U+0020 SPACE, and |duration|. |
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.
should we indicate what the duration represent (milliseconds, seconds, ...) ?
It seems that there is a bit more information about it in the timeEnd section.
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 think what I'll do here is move the example in timeEnd up to here since the first instance of time represented in an implementation-defined format should probably do the explaining. Probably don't need to add it again in timeEnd since it's a repeat step and already will have an example here.
index.bs
Outdated
|
||
<pre><code class="lang-javascript"> | ||
console.time("MyTimer"); | ||
console.timeLog("MyTimer", "Starting application up..."); |
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: Replace ...
with the proper ellipsis char …
index.bs
Outdated
console.timeLog("MyTimer", "UI is setup, making API calls now"); | ||
// Perhaps some fetch()'s here filling the app with data | ||
// ... | ||
console.timeLog("MyTimer", "All done!"); |
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.
Not sure if this case would make sense since timeEnd
already prints the final timer duration.
Also seems reasonable to me. /cc @TheLarkInn (and apologies for the delay!) |
Refs: whatwg/console#138 PR-URL: #21312 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Weijia Wang <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Refs: whatwg/console#138 PR-URL: #21312 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Weijia Wang <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
This PR:
timeLog
to the Console Standard (and specifies that it should usePrinter
instead ofLogger
so we ignore format specifiers appearing in a timer label.timer table
s in the timing methods - this is a little prep work for later when we check (non)existence oftimer table
entries so we can formally report warnings.timeEnd
to actually remove a timer from the timer table (the reason we went with addingtimeLog
)...data
passed intotimeLog
to distinguish calls totimeLog
from each other throughout the duration of a timer.countReset
's permalink to be all lowercase (that seems to be the trend here)Interested in getting some opinions from @xirzec, @nchevobbe, and @JosephPecoraro on this to make sure we have consensus and can get this in ASAP! (will file browser bugs soon)
Bugs