thinlog.bootstraping module#
Bootstrap logging configuration via logging.config.dictConfig().
- thinlog.bootstraping.configure_logging(name: str, config: LoggingSettings | dict[str, Any], extra: dict[str, Any] | None = None, more_loggers: list[str] | None = None, include_default_logger: bool = False, include_registered_loggers: bool = False, include_root_logger: bool = False, disable_log_errors: bool = True) KeywordFriendlyLogger[source]#
Set up the logging system and return a ready-to-use logger.
Applies the configuration, starts any
QueueHandlerlistener, and registers anatexit()handler that stops the listener and callslogging.shutdown()on interpreter exit.Wildcard loggers: If the config contains a logger named
"*", its settings are copied to every logger listed in more_loggers (and those gathered fromRegisteredLoggers). A specific logger can set"merge": trueto extend rather than replace the wildcard config.- Parameters:
name – Name of the primary logger to return.
config – A
LoggingSettingsinstance or a raw dict suitable forlogging.config.dictConfig().extra – Default extra fields for the returned logger.
more_loggers – Additional logger names to configure via the wildcard.
include_default_logger – If
True, add name to more_loggers.include_registered_loggers – If
True, include all names fromRegisteredLoggers.include_root_logger – If
True, apply the wildcard config to the root logger as well.disable_log_errors – If
True(default), setlogging.raiseExceptionstoFalse.
- Returns:
A
KeywordFriendlyLoggerinstance.