peyk.transport.logging_hook¶
Minimal transport logging hook.
Not a full logging system — peyk is a separate repo from hazardastan and has no access to its richer logger. This is deliberately just a three-method Protocol plus a stdlib-logging-backed default, so callers (including hazardastan’s eventual adapter) can supply their own implementation without peyk depending on anything beyond the stdlib.
Functions
A shared, lazily-created StdlibTransportLogger instance. |
Classes
|
Default TransportLogger, backed by logging.getLogger("peyk.transport"). |
|
Logging hook used by the transport layer. |
- class peyk.transport.logging_hook.TransportLogger(*args, **kwargs)[source]¶
Bases:
ProtocolLogging hook used by the transport layer.
The protocol separates request, event, retry, and final-failure logging.
- log_request(method: str, url: str) None[source]¶
Performs the log request operation for the transport client.
- Parameters:
method – Value used by this operation.
url – Target URL.
- log_event(event: object) None[source]¶
Performs the log event operation for the transport client.
- Parameters:
event – Value used by this operation.
- class peyk.transport.logging_hook.StdlibTransportLogger(logger: Logger | None = None)[source]¶
Bases:
objectDefault TransportLogger, backed by logging.getLogger(“peyk.transport”).
Requests log at DEBUG (high-volume, opt-in visibility), retries at WARNING (worth noticing but expected/handled), failures at ERROR (nothing left to retry — the caller now has to deal with it).
- log_request(method: str, url: str) None[source]¶
Performs the log request operation for the transport client.
- Parameters:
method – Value used by this operation.
url – Target URL.
- log_event(event: object) None[source]¶
Performs the log event operation for the transport client.
- Parameters:
event – Value used by this operation.
- peyk.transport.logging_hook.get_default_logger() TransportLogger[source]¶
A shared, lazily-created StdlibTransportLogger instance.
Used by Session and run_with_retry when no TransportLogger is passed explicitly, so A1’s existing call sites (which never pass a logger) keep working unmodified.
- Returns:
The operation result (
TransportLogger).