ng-logger icon indicating copy to clipboard operation
ng-logger copied to clipboard

Can't change Log Level over Browser Console

Open ghost opened this issue 7 years ago • 6 comments

ghost avatar Jul 03 '17 09:07 ghost

I'm not sure how, or couldn't find on the documentation how to change the log level over browser console. Could you confirm if that is possible?

ghost avatar Jul 03 '17 09:07 ghost

Hi @lcarlesso

Thank you for the interest :smiley:

I didn't implement such feature, but it could be a good idea.

Something like

> NgLogger.level = NgLogger.WARN;

I think I can look at it during the week.

noemi-salaun avatar Jul 03 '17 11:07 noemi-salaun

I think it could be a great improvement as well, your library is great already!

Let me know if you need help, Leo

2017-07-03 13:52 GMT+02:00 Noémi Salaün [email protected]:

Hi @lcarlesso https://github.com/lcarlesso

Thank you for the interest 😃

I didn't implement such feature, but it could be a good idea.

Something like

NgLogger.level = NgLogger.WARN;

I think I can look at it during the week.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/noemi-salaun/ng-logger/issues/10#issuecomment-312625859, or mute the thread https://github.com/notifications/unsubscribe-auth/AFsWC4VHGLB3hVhKCYJC_dJqWslC078Qks5sKNXwgaJpZM4OMEQi .

--

Leonardo Carlesso lcarlesso at Gmail.com Fone: +39 342 8350102

"Somewhere, right now, someone is training while you are not. When you race him, he will win." " Sonhar qualquer coisa que você quiser sonhar, esta é a beleza da mente humana.

Fazer qualquer coisa que você quiser fazer, esta é a força da vontade humana.

Confiar em você mesmo para testar seus limites, esta é a coragem para ser bem sucedido."

Bernard Edmons

ghost avatar Jul 03 '17 14:07 ghost

Thanks :grinning:

You can submit a PR if you want to, but your request is not really complicated. I should be able to do it without trouble.

noemi-salaun avatar Jul 03 '17 14:07 noemi-salaun

Awesome,

thanks man

2017-07-03 16:46 GMT+02:00 Noémi Salaün [email protected]:

Thanks 😀

You can submit a PR if you want to, but your request is not really complicated. I should be able to do it without trouble.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/noemi-salaun/ng-logger/issues/10#issuecomment-312664666, or mute the thread https://github.com/notifications/unsubscribe-auth/AFsWC5il3g4R2zUSgWsXeyApG1WFEPwtks5sKP7CgaJpZM4OMEQi .

--

Leonardo Carlesso lcarlesso at Gmail.com Fone: +39 342 8350102

"Somewhere, right now, someone is training while you are not. When you race him, he will win." " Sonhar qualquer coisa que você quiser sonhar, esta é a beleza da mente humana.

Fazer qualquer coisa que você quiser fazer, esta é a força da vontade humana.

Confiar em você mesmo para testar seus limites, esta é a coragem para ser bem sucedido."

Bernard Edmons

ghost avatar Jul 04 '17 09:07 ghost

If you don't need to change the log level in prod mode, I think you can already do it with Augury.

A Google Chrome Dev Tools extension for debugging Angular 2 applications

I have not found the right way to do it properly, using only the console.

Inside the Logger service constructor, I can add something like

constructor(@Inject(LOGGER_LEVEL) level: Level, @Inject(Global) window: Window) {
    this._level = level;

    window.NgLogger = {
        setLevel: (level: Level) => {
            this._level = level;
        }
    }

   // ...
}

but it's not really Angular friendly. How to deal with Logger services that are not used as singleton?

If you find a better way (the correct way) to do it, please let me know 😉

noemi-salaun avatar Jul 04 '17 17:07 noemi-salaun