You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need a simple way to configure the current logger. Ideally to support a few basic desires:
Easily enable debug logging
Log level filtering in general
Per-module log level filtering as would by typical in logging systems like python's.
Because stdlib Logging currently has no opinion about the internal structure of a Logger, I think we just need a neat way of applying some configuration options to either the current, global or (task) local logger. Perhaps just configure_logging(logger::AbstractLogger; kwargs) with configure_logging(:global; ...) applying to the global logger, configure_logging(::Task; ...) applying to a task local logger, and configure_logging(; ...) = configure_logging(current_logger(); ...)?
Logger installation
The current with_logger interface for installing a task-local logger doesn't allow us to install or remove a task local logger permanently. To do that, one needs to dig into the internals which is clearly nasty. To fix this global_logger probably needs a companion which applies to tasks. Or perhaps we unify things to have Logging.logger!(context, logger) set the logger for context to logger:
Logging.logger!(:global, logger) # set global logger
Logging.logger!(some_task, logger) # set task local logger
Similarly, Logging.logger(context) would get the logger installed for context.
The text was updated successfully, but these errors were encountered:
I haven't been following the 0.7 changes changes that much, but the API in Memento would be setlevel!(getlogger(), "debug") (there's also Memento.config("debug")). In this case, the getlogger() returns the current root/global logger and then we're just mutating that logger reference.
I'm not sure I follow the Task logger situation. I would have assumed that a Task could access a logger via some kind of getlogger(...) interface or via an appropriately managed constant.
Here's an issue about two related problems:
Logger configuration
Several people have asked on slack about logger configuration, with the number 1 question being how to enable debug logging.
For the moment the answer is something like
using Logging; global_logger(SimpleLogger(STDERR, Logging.Debug))
, but this is pretty unsatisfactory:ConsoleLogger
or something like it is merged (see ConsoleLogger for more fully featured log printing #25370), they'll be baking in the use ofSimpleLogger
rather than configuring the current logger.We need a simple way to configure the current logger. Ideally to support a few basic desires:
Because stdlib Logging currently has no opinion about the internal structure of a Logger, I think we just need a neat way of applying some configuration options to either the current, global or (task) local logger. Perhaps just
configure_logging(logger::AbstractLogger; kwargs)
withconfigure_logging(:global; ...)
applying to the global logger,configure_logging(::Task; ...)
applying to a task local logger, andconfigure_logging(; ...) = configure_logging(current_logger(); ...)
?Logger installation
The current
with_logger
interface for installing a task-local logger doesn't allow us to install or remove a task local logger permanently. To do that, one needs to dig into the internals which is clearly nasty. To fix thisglobal_logger
probably needs a companion which applies to tasks. Or perhaps we unify things to haveLogging.logger!(context, logger)
set the logger forcontext
tologger
:Similarly,
Logging.logger(context)
would get the logger installed forcontext
.The text was updated successfully, but these errors were encountered: