Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't change Log Level over Browser Console #10

Open
ghost opened this issue Jul 3, 2017 · 6 comments
Open

Can't change Log Level over Browser Console #10

ghost opened this issue Jul 3, 2017 · 6 comments

Comments

@ghost
Copy link

ghost commented Jul 3, 2017

No description provided.

@ghost
Copy link
Author

ghost commented Jul 3, 2017

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 ghost changed the title Can Can't change Log Level over Browser Console Jul 3, 2017
@noemi-salaun
Copy link
Owner

Hi @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.

@ghost
Copy link
Author

ghost commented Jul 3, 2017 via email

@noemi-salaun
Copy link
Owner

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.

@ghost
Copy link
Author

ghost commented Jul 4, 2017 via email

@noemi-salaun
Copy link
Owner

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 noemi-salaun self-assigned this Jul 25, 2017
@noemi-salaun noemi-salaun removed their assignment Jan 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant