noemi-salaun / ng-logger

Angular logger service
63 stars 13 forks source link

Can't change Log Level over Browser Console #10

Open ghost opened 7 years ago

ghost commented 7 years ago

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?

noemi-salaun commented 7 years ago

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.

ghost commented 7 years ago

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 notifications@github.com:

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

noemi-salaun commented 7 years ago

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.

ghost commented 7 years ago

Awesome,

thanks man

2017-07-03 16:46 GMT+02:00 Noémi Salaün notifications@github.com:

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

noemi-salaun commented 7 years ago

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 😉