deno_std icon indicating copy to clipboard operation
deno_std copied to clipboard

log: should expose global state

Open apowers313 opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe.

When developing a system with a large number of dynamic components (e.g. extensions, modules, libraries) the names of the loggers may not be known in advance or may require extensive work to deep dive code and aggregate a list of logger names.

Instead, the log module should expose its internal state allowing developers to programmatically identify all created loggers. This would also enable dynamically adding handlers, changing handler configurations (such as log level), programmatically changing the log level for all created loggers, programmatically changing the log level for loggers matching some pattern, etc.

Describe the solution you'd like

log.handlers and log.loggers as getters for the internal state Maps.

Happy to put together a PR if this is an acceptable direction.

apowers313 avatar Jan 16 '22 17:01 apowers313

Did anyone ever take a look at this?

denizdogan avatar May 07 '23 11:05 denizdogan

This might be in a similar direction https://github.com/denoland/deno_std/pull/2399

kt3k avatar May 10 '23 12:05 kt3k