Repository navigation
feat(core): introduce Logger service - #14308
DzmitryShylovich wants to merge 1 commit into
Conversation
|
Thoughts on implementing Logger.time as console.time? https://developer.mozilla.org/en-US/docs/Web/API/Console/time |
|
console.group as well please. https://developer.mozilla.org/en-US/docs/Web/API/Console/group |
|
I believe all JavaScript platforms have What do you think? |
|
IE9 might need special treatment, because (Just pointing out that special treatment might be needed, not implying that it shouldn't be done.) |
There was a problem hiding this comment.
We've been discussing about removing this method from AngularJS.
Stringifying the error, breaks source map supports (see angular/angular.js#15590 (comment) for more info).
There was a problem hiding this comment.
Yeah, I'm in the process of removing this function for AngularJS 1.7 for all the browsers with the exception of IE/Edge (as their error logging is far from ideal). Chrome/Safari apply source maps to logged errors, Firefox is in a process of implementing that as well. By adding this function you'll break it and if you use Webpack - which many people will as that's what Angular CLI uses - you'll just see references to app.bundle.js or vendor.bundle.js which makes making sense out of the stack virtually impossible.
There was a problem hiding this comment.
Currently this method is not used.
There was a problem hiding this comment.
That's true. Can it just be removed then?
There was a problem hiding this comment.
do we really need this check? afaik ng2 doesn't officially support ie8
There was a problem hiding this comment.
Yeah, try-catch shouldn't be needed any more. Guarding against missing console.log.apply is as IE 9 has console method not inheriting from Function.prototype.
|
@mhevery you're right, console is available on on supported platforms. Also added |
|
rebase please |
|
@mhevery rebased |
|
We decided to not merge this in as at is a new feature and @IgorMinar and I need to debate whether we want to add and support this kind of features. |
There was a problem hiding this comment.
Please remove @param args and make comment 1 liners
There was a problem hiding this comment.
private _getConsoleMethod(method, args) and remove all the private wrappers.
There was a problem hiding this comment.
but in this case we will need to make unnecessary checks on every invocation.
There was a problem hiding this comment.
Not sure if the comments are necessary on the Logs prop
There was a problem hiding this comment.
there's a similar comments in ng1. I thought it would be useful for generated api docs
|
@mhevery @IgorMinar Yep, it would be good to have it, we use a mic of |
|
I'm puzzled and can't figure out why a framework wouldn't have a logging system :-/ |
|
So, 2 months on 1 million people have introduced a nigh-on identical but independent "custom" LoggingService into their apps. C'mon what's to consider here? |
IgorMinar
left a comment
There was a problem hiding this comment.
My primary issue with this PR is that logging typically becomes very expensive (in terms of payload-size) very quickly. Until we have a design that can safely strip non-critical logs and minify the critical ones I think everyone is better off rolling their own solution. The api above would likely need to be changed to achieve these properties, and doing so after these apis are heavily used would be very disruptive and painful for everyone.
The cross-cutting concern of logging and necessity to provide a solution that works well for 3rd party components makes this a much harder problem than what it looks like on the surface and we are better off deferring tackling this problem rather than providing a solution that would send everyone down the wrong path.
|
@IgorMinar Should we close this task? |
|
@DzmitryShylovich @mhevery Is the PR is relevant? |
|
Closing per @IgorMinar's comment. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Closes #5458