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

Change Log Level for root and children #1330

Closed
DevNamedZed opened this issue Feb 12, 2022 · 2 comments
Closed

Change Log Level for root and children #1330

DevNamedZed opened this issue Feb 12, 2022 · 2 comments

Comments

@DevNamedZed
Copy link

I am working on a CLI app and want the user to pass be able to pass in a debug flag that modifies the log level. Our code has a singleton root and many child loggers that are created as module level constants.

We are currently using commander.js for cli arg parsing. We were considering writing some additional custom arg parsing for setting the level when the loggers get created but now are looking at switching some of the proxy hack solutions that we have seen online. There are a number of other github issues.

This seems like a super basic scenario. Can we get a callback or something so we can override specify the log level on root and all children?

@mcollina
Copy link
Member

The best way to approach this is to add all created loggers in a array and iterate that to change the levels.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants