Choose the transport
| Output | Surface | Boundary to check |
|---|---|---|
| Console | FemtoStreamHandler | stdout/stderr, flush acknowledgement |
| File | FemtoFileHandler | Capacity and overflow policy |
| Size rotation | FemtoRotatingFileHandler | Positive size and backup count |
| Time rotation | FemtoTimedRotatingFileHandler | Schedule, timezone, retention |
| Socket | SocketHandlerBuilder | MessagePack framing, TLS, retries |
| HTTP | HTTPHandlerBuilder | One 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.