-
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.countReset #133
Conversation
…count map as containing numbers
The Edge reports aren't quite correct. They're more like:
|
The two points under "No arguments" also apply to |
No, then it produces the two points under "A string". |
Actually, here's what's going on...
I remember us discussing this "update previous stuff" behavior in some other thread. I think it's generally meant to be covered by https://console.spec.whatwg.org/#printer-ux-innovation. So there are basically two questions:
|
IMO I don't think Regarding the second question, I'd like to align this as closely with timeEnd() as possible (the two sets of functions have nice parallels I think). So, print a warning and don't touch any counters. Thoughts? |
imo: if the count doesn't exist, return, optionally reporting a warning to the console. as this method is a part of console, explicitly calling the logger makes a lot of sense in my mind. |
I'd rather countReset not invoke the printer and I'm just fine with a warning when the counter being reset does not exist. I think we should also be clear that calling countReset on a non-existent counter does not create the counter. |
I'm fine with changing the behavior to not print/update the count when calling countReset(). If we are updating previous instances though, should a call to count() after countReset() still update the previous log entry? Or should countReset() cause the next count() to start a new entry that gets updated? cc: @TheLarkInn |
I agree with @jasnell on:
These things are currently covered by the spec I have proposed. @xirzec, Given Domenic's previous comment about Printer UX innovation, it seems either of those options are valid. If it were up to me I kind of like the idea that countReset() causes the next count() to start a new update-able entry, but either way... Since we have agreement on this from Edge and Node, I'll merge this right after web-platform-tests/wpt#10722 and file some browser bugs. |
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 it would be possible to align the specs for console.countReset()
and console.timeEnd()
more closely if the optionality of the warning step was the same in both specs.
Currently, that step is optional in console.timeEnd()
but not in console.countReset()
. The warnings could be both required or both optional.
Also, the spec for console.timeEnd()
does not explicitly prescribe what 'logLevel' should be used for the warning, whereas console.countReset()
does.
I agree with aligning the specs for No, the spec for both |
My apologies, I was wrong. It is
These warnings have something in common, being not the primarily intended output of the method calls, but alerting the developer about an incorrect usage of the console API. I am not questioning the idea of having every console method pass its own name as the logLevel for its usual output, I think it's a great design choice. But I'm not sure the same Hence my allusion to the possibility of leaving the logLevel of |
Bugs:
@fmartin5 Thanks for your input! I very much agree with your thoughts on not using the existing infrastructure for reporting errors, and I think this is a great task for #57. The solution for this should define some infrastructure responsible for printing things other than intended console output (and define hook-able infra for other specs to tap into). I can make this one of my next priorities because I agree it is pretty important. For now, I think we should use the current infrastructure (Logger/Printer etc) until this changes, if that makes sense? |
We've discussed adding a method
countReset
toconsole
in #89. We've got two major implementations that have it, so it seems worth speccing, however the two behave differently. There are two things it seems we have to specify: How calls to the API should behave with a label that has:console.countReset("labelWithCount")
console.countReset("labelWithNoCount")
Here are the proposals I have in this PR:
timeEnd()
prints a warning indicating that no timer exists for the given label. All implementations do this right now (though I can't confirm Edge).If we can get agreement on this from Edge (@xirzec / @TheLarkInn) and Node (@jasnell) and converge on either the behavior specified in this PR or something else, that would be great and we could finish the spec here and get other implementations on board. Thoughts?
Note this PR fixes another linking error unrelated to this change