pino icon indicating copy to clipboard operation
pino copied to clipboard

Change Log Level for root and children

Open DevNamedZed opened this issue 3 years ago • 1 comments
trafficstars

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?

DevNamedZed avatar Feb 12 '22 14:02 DevNamedZed

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

mcollina avatar Feb 12 '22 17:02 mcollina

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[bot] avatar Mar 20 '23 00:03 github-actions[bot]