silkworm.logging¶
Structured logging interfaces and configuration helpers for Silkworm.
Log records accept arbitrary keyword context. The shared logger defaults to
stderr and reads SILKWORM_LOG_LEVEL the first time it is requested.
- class silkworm.logging.Logger[source]¶
Bases:
ProtocolStructured logger returned by
get_logger()andSpider.log.Keyword arguments become structured context fields on each record.
- configure(*, handlers=None)[source]¶
Replace the logger’s handlers with the supplied configurations.
Each handler mapping accepts
sink,level,serialize, andcolorize. A sink may be"stderr","stdout", a filesystem path, or a writable text stream.
- exception(message, **context)[source]¶
Emit an error record including the active exception traceback.
- __init__(*args, **kwargs)¶
- silkworm.logging.complete_logs()[source]¶
Flush configured log handlers if logging has been initialized.
- Return type:
None
- silkworm.logging.get_logger(**context)[source]¶
Return the shared structured logger, optionally bound to
context.The first call configures stderr output using
SILKWORM_LOG_LEVEL. Bound context is copied into every record without mutating the shared base logger.