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.
FemtoHandler
Options and record-facing surface. See the declarations and behavioural guide for supported settings.
FemtoStreamHandler
stdout/stderr output on a dedicated worker. Flush returns a boolean acknowledgement, not an unconditional success.
FemtoFileHandler
Worker-backed file output. Defaults: capacity 1024, flush_interval 1 record, policy drop. Flush and close are explicit.
FemtoRotatingFileHandler
Size-based file rotation. Both max_bytes and backup_count must be positive to enable rollover.
class FemtoRotatingFileHandler:
def __init__(self, path: str, options: HandlerOptions | None=...) -> None:
...
@property
def max_bytes(self) -> int:
...
@property
def backup_count(self) -> int:
...
def handle(self, logger: str, level: LevelArg, message: str) -> None:
...
def flush(self) -> bool:
...
def close(self) -> None:
...
FemtoTimedRotatingFileHandler
Scheduled file rotation. A zero backup count keeps all timestamped backups.
class FemtoTimedRotatingFileHandler:
def __init__(self, path: str, options: TimedHandlerOptions | None=...) -> None:
...
@property
def when(self) -> str:
...
@property
def interval(self) -> int:
...
@property
def backup_count(self) -> int:
...
@property
def utc(self) -> bool:
...
@property
def at_time(self) -> str | None:
...
def handle(self, logger: str, level: LevelArg, message: str) -> None:
...
def flush(self) -> bool:
...
def close(self) -> None:
...
FemtoSocketHandler
MessagePack output with four-byte length framing. Build via SocketHandlerBuilder. TLS requires TCP; Unix sockets require POSIX.
FemtoHTTPHandler
Worker-backed HTTP output. Build via HTTPHandlerBuilder. Bounded close may abandon pending requests when the endpoint does not respond.
StreamHandlerBuilder
Fluent configuration for StreamHandler. Validate options and call build before registering output.
class StreamHandlerBuilder:
def __init__(self) -> None:
...
@staticmethod
def stdout() -> StreamHandlerBuilder:
...
@staticmethod
def stderr() -> StreamHandlerBuilder:
...
def with_capacity(self, capacity: int) -> Self:
...
def with_flush_after_ms(self, flush_ms: int) -> Self:
...
def with_formatter(self, formatter: object) -> Self:
...
def as_dict(self) -> dict[str, object]:
...
def build(self) -> FemtoStreamHandler:
...
FileHandlerBuilder
Fluent configuration for FileHandler. Validate options and call build before registering output.
class FileHandlerBuilder:
def __init__(self, path: str) -> None:
...
def with_capacity(self, capacity: int) -> Self:
...
def with_flush_after_records(self, interval: int) -> Self:
...
def with_overflow_policy(self, policy: OverflowPolicy) -> Self:
...
def with_formatter(self, formatter: object) -> Self:
...
def as_dict(self) -> dict[str, object]:
...
def build(self) -> FemtoFileHandler:
...
RotatingFileHandlerBuilder
Fluent configuration for RotatingFileHandler. Validate options and call build before registering output.
class RotatingFileHandlerBuilder:
def __init__(self, path: str) -> None:
...
def with_max_bytes(self, max_bytes: int) -> Self:
...
TimedRotatingFileHandlerBuilder
Fluent configuration for TimedRotatingFileHandler. Validate options and call build before registering output.
class TimedRotatingFileHandlerBuilder:
def __init__(self, path: str, options: TimedHandlerOptions | None=...) -> None:
...
def with_when(self, when: str) -> Self:
...
def with_interval(self, interval: int) -> Self:
...
def with_utc(self, use_utc: bool) -> Self:
...
def with_at_time(self, at_time: dt.time | None) -> Self:
...
SocketHandlerBuilder
Fluent configuration for SocketHandler. Validate options and call build before registering output.
class SocketHandlerBuilder:
def __init__(self) -> None:
...
def with_tcp(self, host: str, port: int) -> Self:
...
def with_unix_path(self, path: str) -> Self:
...
def with_max_frame_size(self, size: int) -> Self:
...
def with_tls(self, domain: str | None=..., *, insecure: bool=...) -> Self:
...
HTTPHandlerBuilder
Fluent configuration for HTTPHandler. Validate options and call build before registering output.
class HTTPHandlerBuilder:
def __init__(self) -> None:
...
def with_endpoint(self, url: str, method: str=...) -> Self:
...
def with_url(self, url: str) -> Self:
...
def with_method(self, method: str) -> Self:
...
def with_auth(self, config: HTTPBasicAuthConfig | HTTPTokenAuthConfig) -> Self:
...
def with_basic_auth(self, username: str, password: str) -> Self:
...
def with_bearer_token(self, token: str) -> Self:
...
def with_headers(self, headers: Mapping[str, str]) -> Self:
...
def with_json_format(self) -> Self:
...
def with_record_fields(self, fields: list[str]) -> Self:
...
HandlerOptions
Options and record-facing surface. See the declarations and behavioural guide for supported settings.
class HandlerOptions:
max_bytes: int
backup_count: int
def __init__(self, capacity: int=..., flush_interval: int=..., policy: PolicyName=..., rotation: tuple[int, int] | None=...) -> None:
...
TimedHandlerOptions
Options and record-facing surface. See the declarations and behavioural guide for supported settings.
class TimedHandlerOptions:
when: str
interval: int
backup_count: int
utc: bool
def __init__(self, capacity: int=..., flush_interval: int=..., policy: PolicyName=..., when: str=..., interval: int=..., backup_count: int=..., utc: bool=..., at_time: dt.time | None=...) -> None:
...
@property
def at_time(self) -> str | None:
...
BackoffConfig
Options and record-facing surface. See the declarations and behavioural guide for supported settings.
class BackoffConfig:
def __init__(self, config: BackoffConfigDict | None=None) -> None:
...
OverflowPolicy
File handler queue policy: drop, block, or timeout in milliseconds. It does not change the upstream logger queue policy.
class OverflowPolicy:
@staticmethod
def drop() -> OverflowPolicy:
...
@staticmethod
def block() -> OverflowPolicy:
...
@staticmethod
def timeout(timeout_ms: int) -> OverflowPolicy:
...
StdlibHandlerAdapter
Translate rich runtime records to a configured logging.Handler. Configure before registration; flush and close the adapter after delivery.
class StdlibHandlerAdapter:
def __init__(self, handler: logging.Handler) -> None:
...
@staticmethod
def handle(_logger: str, _level: str, _message: str) -> None:
...
def handle_record(self, record: FemtoRecord) -> None:
...
def flush(self) -> None:
...
def close(self) -> None:
...