thinlog.bootstraping module

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 QueueHandler listener, and registers an atexit() handler that stops the listener and calls logging.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 from RegisteredLoggers). A specific logger can set "merge": true to extend rather than replace the wildcard config.

Parameters:
  • name – Name of the primary logger to return.

  • config – A LoggingSettings instance or a raw dict suitable for logging.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 from RegisteredLoggers.

  • include_root_logger – If True, apply the wildcard config to the root logger as well.

  • disable_log_errors – If True (default), set logging.raiseExceptions to False.

Returns:

A KeywordFriendlyLogger instance.