You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I notice that you create and destroy the methods on the fly. Or something like.
The thing is that doing this prevents me from being able to do something like this:
APP.logger.log = log.info.bind(log);
Meaning I am able to abstract your library just in case we need to switch it later.
This works, buts looks unnecessary:
function info(msg) {
log.info(msg);
}
APP.logger.log = info;
Thanks
The text was updated successfully, but these errors were encountered:
Hmmm. The core problem isn't that we're creating and destroying methods, it's actually that we're not creating any methods; all that happens is log.info gets assigned to a bound version of console.info, when you call setLevel, or a single noop method that gets assigned to it instead (see loglevel.js lines 124-126)
This can't stop happening; doing that rather than wrapping the function in a method that looks at the level and then calls the appropriate method is what stops it from clobbering the stacktraces. If you wrap the methods, then chrome and firefox shows the message as coming from inside loglevel, rather than from whichever line you actually called it from (which is extremely annoying).
I do see you use case though, that makes sense. Any other suggestions for methods to fix this?
I haven't thought about the stacktraces consideration at all, that is definitely important. I don't have any suggestions for the moment. Will have another look later on.
For now I'm going to close this. Do feel free to shout (either @sporto or anybody else) if you disagree, I'm very happy to reopen it if anybody can think of any other options that do support this use case.
Hi
I notice that you create and destroy the methods on the fly. Or something like.
The thing is that doing this prevents me from being able to do something like this:
Meaning I am able to abstract your library just in case we need to switch it later.
This works, buts looks unnecessary:
Thanks
The text was updated successfully, but these errors were encountered: