pimterry/loglevel

log is not defined when attempting setLevel() in console

nboxall1 opened this issue · 3 comments

Apologies, this is more of a question than a bug report. In the documentation it says "...then run log.setLevel("trace") in your console to turn it all back on...". I'm using Chrome on a Mac. When I enter log.setLevel("trace") in the dev tools console for an app I am developing with has imported loglevel as log i'm getting "Uncaught ReferenceError: log is not defined". I'm obviously missing something here so any tips would be greatly appreciated.

It sounds like log is not available in the global scope, for example you've imported it only inside a module of your application, so it's only defined in that scope. Does that sound plausible?

If you want to access log globally, you'll either need to import it globally somehow, or more likely you want to expose it globally from your application code, e.g. by putting window.log = log inside your application code.

Yes, window.log = log in my root project file did it for me. Thanks so much for the instant response!

No problem, glad to hear that worked for you!