config_wrangler.config_templates.logging_config module

class config_wrangler.config_templates.logging_config.FileHandlerClass(*values)[source]

Bases: StrEnum

class config_wrangler.config_templates.logging_config.LogLevel(*values)[source]

Bases: StrEnum

pydantic model config_wrangler.config_templates.logging_config.LoggingConfig[source]

Bases: ConfigHierarchy

Config:
  • validate_default: bool = True

  • validate_assignment: bool = True

  • validate_credentials: bool = True

Fields:
  • add_date_to_log_file_name (bool | None)

  • console_entry_format (str)

  • console_log_level (config_wrangler.config_templates.logging_config.LogLevel)

  • file_log_level (config_wrangler.config_templates.logging_config.LogLevel)

  • log_file_entry_format (str)

  • log_file_max_size (pydantic.types.ByteSize)

  • log_file_name (str | None)

  • log_file_name_date_time_format (str)

  • log_file_rotation_class (config_wrangler.config_templates.logging_config.FileHandlerClass)

  • log_file_timed_rotation_attime (datetime.time | None)

  • log_file_timed_rotation_interval (int)

  • log_file_timed_rotation_utc (bool)

  • log_file_timed_rotation_when (str)

  • log_files_to_keep (int)

  • log_folder (pathlib.Path | None)

  • log_levels (Dict[str, config_wrangler.config_templates.logging_config.LogLevel])

  • logging_date_format (str)

  • trace_logging_setup (bool)

Validators:
  • _validate_logging » all fields

add_child(name: str, child_object: ConfigHierarchy)

Set this configuration as a child in the hierarchy of another config. For any programmatically created config objects this is required so that the new object ‘knows’ where it lives in the hierarchy – most importantly so that it can find the hierarchies root object.

add_log_file_handler(log_file_prefix: str = None, add_date_to_log_file_name: bool = None, log_file_suffix: str = '.log') Handler[source]
full_item_name(item_name: str | None = None, delimiter: str = ' -> ')

The fully qualified name of this config item in the config hierarchy.

get_copy(copied_by: str = 'get_copy') ConfigHierarchy

Copy this configuration. Useful when you need to programmatically modify a configuration without modifying the original base configuration.

static get_dated_log_file_name(log_file_prefix: str, date_time_format: str, log_file_suffix: str = '.log')[source]

Generates a log file name with a given prefix, suffix and date time format.

Parameters:
  • log_file_prefix (str) – The part of the log file name before the date

  • log_file_suffix (str) – The part of the log file name after the date

  • date_time_format (str) – Optional. The date time format to use. Defaults to ‘_%Y_%m_%d_at_%H_%M_%S’

log_file_manager(log_file_prefix: str = None, add_date_to_log_file_name: bool = False, log_file_suffix: str = '.log')[source]
model_dump_non_private(*, mode: Literal['json', 'python'] | str = 'python', exclude: Set[str] | None = None) dict[str, Any]
remove_log_handler(handler: Handler)[source]
set_as_child(name: str, other_config_item: ConfigHierarchy)
setup_log_levels()[source]
setup_logging(log_file_prefix: str = None, add_date_to_log_file_name: bool = None, log_file_suffix: str = '.log', console_output=None, use_log_file_setting=True)[source]

Setup logging based on configuration.

static translate_config_data(config_data: MutableMapping)

Children classes can provide translation logic to allow older config files to be used with newer config class definitions.