demessaging.config.logging module

Configuration module for logging in DASF.

This module defines the configuration class for logging within the DASF Framework.

Classes:

LoggingConfig([_case_sensitive, ...])

Configuration for logging.

class demessaging.config.logging.LoggingConfig(_case_sensitive: bool | None = None, _nested_model_default_partial_update: bool | None = None, _env_prefix: str | None = None, _env_file: DotenvType | None = PosixPath('.'), _env_file_encoding: str | None = None, _env_ignore_empty: bool | None = None, _env_nested_delimiter: str | None = None, _env_nested_max_split: int | None = None, _env_parse_none_str: str | None = None, _env_parse_enums: bool | None = None, _cli_prog_name: str | None = None, _cli_parse_args: bool | list[str] | tuple[str, ...] | None = None, _cli_settings_source: CliSettingsSource[Any] | None = None, _cli_parse_none_str: str | None = None, _cli_hide_none_type: bool | None = None, _cli_avoid_json: bool | None = None, _cli_enforce_required: bool | None = None, _cli_use_class_docs_for_groups: bool | None = None, _cli_exit_on_error: bool | None = None, _cli_prefix: str | None = None, _cli_flag_prefix_char: str | None = None, _cli_implicit_flags: bool | None = None, _cli_ignore_unknown_args: bool | None = None, _cli_kebab_case: bool | Literal['all', 'no_enums'] | None = None, _cli_shortcuts: Mapping[str, str | list[str]] | None = None, _secrets_dir: PathType | None = None, *, config_file: Annotated[Path, PathType(path_type=file)] = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/dasf/checkouts/latest/demessaging/config/logging.yaml'), level: Annotated[int, Gt(gt=0)] | None = None, logfile: Path | None = None, config_overrides: Dict | None = None, merge_config: bool = False)[source]

Bases: BaseSettings

Configuration for logging.

Parameters:
  • config_file (pathlib.Path) – Path to the logging configuration.

  • level (Optional[Annotated[int, Gt(gt=0)]]) – Level for the logger. Setting this will override any levels specified in the logging config file. The lower the value, the more verbose the logging. Typical levels are 10 (DEBUG), 20 (INFO), 30 (WARNING), 40 (ERROR) and 50 (CRITICAL).

  • logfile (Optional[pathlib.Path]) – A path to use for logging. If this is specified, we will add a RotatingFileHandler that loggs to the given path and add this handler to any logger in the logging config.

  • config_overrides (Optional[Dict]) – A dictionary to override the configuration specified in the logging configuration file.

  • merge_config (bool) – If this is True, the specified logging configuration file will be merged with the default one at /home/docs/checkouts/readthedocs.org/user_builds/dasf/checkouts/latest/demessaging/config/logging.yaml

Attributes:

config_dict

Configuration dictionary for the logging.

config_file

config_overrides

level

logfile

merge_config

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Methods:

configure_logging()

Configure the loggers based upon the given config.

property config_dict: Dict

Configuration dictionary for the logging.

config_file: Annotated[Path, PathType(path_type=file)]
config_overrides: Dict | None
configure_logging()[source]

Configure the loggers based upon the given config.

level: Annotated[int, Gt(gt=0)] | None
logfile: Path | None
merge_config: bool
model_config: ClassVar[SettingsConfigDict] = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_flag_prefix_char': '-', 'cli_hide_none_type': False, 'cli_ignore_unknown_args': False, 'cli_implicit_flags': False, 'cli_kebab_case': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_shortcuts': None, 'cli_use_class_docs_for_groups': False, 'enable_decoding': True, 'env_file': None, 'env_file_encoding': None, 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_nested_max_split': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': 'de_logging_', 'extra': 'forbid', 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_customise_sources'), 'secrets_dir': None, 'toml_file': None, 'validate_default': True, 'yaml_config_section': None, 'yaml_file': None, 'yaml_file_encoding': None}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].