Skip to content
femtologging
Menu

Guides

Choose and configure output

Every output brings its own capacity, I/O failures, and lifecycle.

0.2.0 surface · 0.2.0-beta1 forthcoming

Choose the transport

OutputSurfaceBoundary to check
ConsoleFemtoStreamHandlerstdout/stderr, flush acknowledgement
FileFemtoFileHandlerCapacity and overflow policy
Size rotationFemtoRotatingFileHandlerPositive size and backup count
Time rotationFemtoTimedRotatingFileHandlerSchedule, timezone, retention
SocketSocketHandlerBuilderMessagePack framing, TLS, retries
HTTPHTTPHandlerBuilderOne request per record, bounded close

Set file policies deliberately

File handler defaults are capacity=1024, flush_interval=1, and policy="drop". The flush interval counts records. Drop, block, and timeout:N are handler queue policies, not guarantees about the logger queue that precedes them.

Size rotation needs both max_bytes and backup_count greater than zero. Timed rotation supports S, M, H, D, MIDNIGHT, and W0–W6; a timed backup_count of zero keeps all backups.

Treat network output as a destination

Socket handlers frame MessagePack records with a four-byte big-endian length prefix. TLS requires TCP; Unix sockets are available on POSIX. Oversized frames can be dropped. Configure connect/write timeouts and backoff.

HTTP handlers send one record per request. Close waits for at most the write timeout; an unresponsive worker can be abandoned with queued records still pending. Review messages and fields before sending them to external sinks.

Adapt a Python handler

Configure a Python handler completely before registering it. Capability detection is cached at registration: use handle_record(record) for a rich record dictionary or handle(logger, level, message) for the simpler contract.

StdlibHandlerAdapter translates records for an existing logging.Handler. Run the adapter example.