[BUGFIX lts] Avoid console.trace for every Ember.warn #17398
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Originally (Ember < 3.2),
Ember.warn
usedEmber.Logger
as an abstraction layer in caseconsole
was not present. SinceEmber.Logger
was deprecated in emberjs/rfcs#297 the internals have been refactored to useconsole
directly instead.When that change was made, the following:
Was changed to:
This seems correct, however when you dig into it you will notice that the
Ember.Logger
class never had a.trace
method! The reason for the original'trace' in Logger
check was specifically so that you could doEmber.Logger.trace = () => console.trace
IIF you wanted to see where a given warning was coming from. That was added back in 2012, but since then the developer tools of modern browsers have gotten massively better. At this point, everyconsole.log
/console.warn
tracks its stack trace so that you can drill into the source in the dev tools. The primary difference between that functionality and callingconsole.trace()
directly like this is that withconsole.warn
the stack trace is hidden by default (and has to be manually expanded), whereas withconsole.trace()
it is always called and the full stack is printed.tldr; when we refactored to address the
Ember.Logger
deprecation, we began callingconsole.trace
for everyEmber.warn
invocation and theconsole.trace()
calls make the console fairly unusable even with a very low volumn of warnings.