Specify console.timeLog() + clean up timing#138
Conversation
|
|
||
| <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.
A small typo here, the word "given" is misspelled. This looks good otherwise :)
| 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.
This should probably map/remove but I have to take a closer look
There was a problem hiding this comment.
You should be able to just do [=map/Remove=]
| 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.
You should be able to just do [=map/Remove=]
| <td> | ||
| {{console/log()}}, {{console/trace()}}, {{console/dir()}}, {{console/dirxml()}}, | ||
| {{console/group()}}, {{console/groupCollapsed()}}, {{console/debug()}} | ||
| {{console/group()}}, {{console/groupCollapsed()}}, {{console/debug()}} {{console/timeLog()}} |
| 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.
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. |
nchevobbe
left a comment
There was a problem hiding this comment.
Some small comments, but this looks good to me
| 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.
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.
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.
|
|
||
| <pre><code class="lang-javascript"> | ||
| console.time("MyTimer"); | ||
| console.timeLog("MyTimer", "Starting application up..."); |
There was a problem hiding this comment.
nit: Replace ... with the proper ellipsis char …
| 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.
Not sure if this case would make sense since timeEndalready 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 <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
Refs: whatwg/console#138 PR-URL: #21312 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
This PR:
timeLogto the Console Standard (and specifies that it should usePrinterinstead ofLoggerso we ignore format specifiers appearing in a timer label.timer tables in the timing methods - this is a little prep work for later when we check (non)existence oftimer tableentries so we can formally report warnings.timeEndto actually remove a timer from the timer table (the reason we went with addingtimeLog)...datapassed intotimeLogto distinguish calls totimeLogfrom 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