Skip to content
femtologging
Menu

API reference

Configuration and mutation

Public declarations and behavioural boundaries for the prospective 0.2.0 surface.

0.2.0 surface · 0.2.0-beta1 forthcoming

The declarations below are transcribed from the public source and extension stubs at f5bcaa8. Ellipses mark defaults unspecified by the stub. Self denotes the same fluent builder type; _Any is the stub’s alias for typing.Any.

BasicConfig

Slotted configuration in the prospective 0.2.0 surface. Only five declared fields are supported.

class BasicConfig:
    level: str | int | None = None
    filename: str | None = None
    stream: typ.TextIO | None = None
    force: bool = False
    handlers: cabc.Iterable[FemtoHandler] | None = None

View source declaration

basicConfig

Configure the root using level, filename, stream, force, or handlers. Output choices are mutually exclusive; stdlib format/datefmt are unsupported.

def basicConfig(config: BasicConfig, /) -> None:
    ...

View source declaration

ConfigBuilder

Prepare handler/filter references and the mandatory root configuration before initializing live logger state.

View source declaration

LoggerConfigBuilder

Fluent configuration for LoggerConfig. Validate options and call build before registering output.

View source declaration

RuntimeConfigBuilder

Apply the supported live logger mutations after validation.

class RuntimeConfigBuilder:
    def __init__(self) -> None:
        ...
    def with_filter(self, fid: str, builder: RuntimeFilterBuilder) -> Self:
        ...
    def with_handler(self, hid: str, builder: RuntimeHandlerBuilder) -> Self:
        ...
    def with_logger(self, lname: str, builder: LoggerMutationBuilder) -> Self:
        ...
    def with_root_logger(self, builder: LoggerMutationBuilder) -> Self:
        ...
    def apply(self) -> None:
        ...
    def as_dict(self) -> dict[str, object]:
        ...

View source declaration

LoggerMutationBuilder

Describe logger level, propagation, handler, and filter mutations by identifier.

class LoggerMutationBuilder:
    def __init__(self) -> None:
        ...
    def with_level(self, level: LevelArg) -> Self:
        ...
    def with_propagate(self, propagate: bool) -> Self:
        ...
    def replace_handlers(self, ids: list[str]) -> Self:
        ...
    def append_handlers(self, ids: list[str]) -> Self:
        ...
    def remove_handlers(self, ids: list[str]) -> Self:
        ...
    def clear_handlers(self) -> Self:
        ...
    def replace_filters(self, ids: list[str]) -> Self:
        ...
    def append_filters(self, ids: list[str]) -> Self:
        ...
    def remove_filters(self, ids: list[str]) -> Self:
        ...
    def clear_filters(self) -> Self:
        ...
    def as_dict(self) -> dict[str, object]:
        ...

View source declaration

dictConfig

Restricted version-1 dictionary configuration. Root is required; handler filters/levels/formatters and incremental updates are unsupported.

def dictConfig(config: cabc.Mapping[str, object]) -> None:
    ...

View source declaration

fileConfig

INI configuration translated into the restricted dictConfig schema. Unsupported handler overrides and formatter sections raise ValueError.

def fileConfig(fname: str | bytes | PathLike[str] | PathLike[bytes], defaults: cabc.Mapping[str, object] | None=None, *, disable_existing_loggers: bool=True, encoding: str | None=None) -> None:
    ...

View source declaration