Skip to content

omnipy.config.root_log

CLASS DESCRIPTION
RootLogConfig

RootLogConfig

Bases: ConfigBase

ATTRIBUTE DESCRIPTION
file_log_min_level

TYPE: int

file_log_path

TYPE: str

locale

TYPE: LocaleType

log_format_str

TYPE: str

log_to_file

TYPE: bool

log_to_stderr

TYPE: bool

log_to_stdout

TYPE: bool

stderr

TYPE: TextIOBase

stderr_log_min_level

TYPE: int

stdout

TYPE: TextIOBase

stdout_log_min_level

TYPE: int

Source code in src/omnipy/config/root_log.py
class RootLogConfig(ConfigBase):
    log_format_str: str = '[{engine}] {asctime} - {levelname}: {message} ({name})'
    locale: LocaleType = pkg_locale.getlocale()
    log_to_stdout: bool = True
    log_to_stderr: bool = True
    log_to_file: bool = True
    stdout: TextIOBase = pyd.Field(default_factory=lambda: sys.stdout)
    stderr: TextIOBase = pyd.Field(default_factory=lambda: sys.stderr)
    stdout_log_min_level: int = logging.INFO
    stderr_log_min_level: int = logging.ERROR
    file_log_min_level: int = logging.WARNING
    file_log_path: str = pyd.Field(default_factory=_get_log_path)

    def _iter(self, **kwargs) -> Generator[tuple[str, Any], None, None]:  # type: ignore[override]
        for key, val in super()._iter(**kwargs):
            if key in ['stdout', 'stderr']:
                # Convert TextIOBase to str for serialization
                yield key, repr(val)
            else:
                yield key, val

file_log_min_level class-attribute instance-attribute

file_log_min_level: int = logging.WARNING

file_log_path class-attribute instance-attribute

file_log_path: str = pyd.Field(default_factory=_get_log_path)

locale class-attribute instance-attribute

locale: LocaleType = pkg_locale.getlocale()

log_format_str class-attribute instance-attribute

log_format_str: str = '[{engine}] {asctime} - {levelname}: {message} ({name})'

log_to_file class-attribute instance-attribute

log_to_file: bool = True

log_to_stderr class-attribute instance-attribute

log_to_stderr: bool = True

log_to_stdout class-attribute instance-attribute

log_to_stdout: bool = True

stderr class-attribute instance-attribute

stderr: TextIOBase = pyd.Field(default_factory=lambda: sys.stderr)

stderr_log_min_level class-attribute instance-attribute

stderr_log_min_level: int = logging.ERROR

stdout class-attribute instance-attribute

stdout: TextIOBase = pyd.Field(default_factory=lambda: sys.stdout)

stdout_log_min_level class-attribute instance-attribute

stdout_log_min_level: int = logging.INFO