Skip to main content

Module log

Module log 

Source
Expand description

Flow-level debug logging utilities.

At most one global listener can be registered. When no listener is present, emit/emit_lazy return quickly with minimal overhead. Listener panics are isolated with catch_unwind so SDK internal logic remains safe.

§Log levels and persistence

Consumers register a single listener via set_debug_log_listener and receive every Log the SDK emits. Each entry carries a LogLevel that tells the consumer how to treat it. Use LogLevel::persist_recommended to decide what to keep:

LevelMeaningPersist?
LogLevel::Traceper-chunk / per-poll / per-retry hot-loop noiseNo — drop or sample only
LogLevel::Debuglow-volume diagnosticsoptional / short-term only
LogLevel::Infonormal operational informationoptional
LogLevel::Keykey-node checkpoint for troubleshootingYes — keep and forward to the SDK author
LogLevel::Warnrecoverable anomaly / misuse / backpressureYes
LogLevel::Errorfailure with full detail, or a caught panicYes

The author-forwardable troubleshooting stream is everything at >= LogLevel::Key, i.e. Key | Warn | Error. Never persist a high-frequency Trace entry, and never persist any URL or task dump that has not been run through sanitize_url.

Structs§

DebugLogListenerError
Log
One structured log record that can be printed or persisted externally.

Enums§

LogLevel
Log severity level for flow debug entries.

Functions§

debug_log_listener_active
Returns whether a debug log listener is currently registered.
emit
Emits one log entry.
emit_lazy
Lazily emits a log entry only when listener is active.
redact_secrets
Redacts secret key=value pairs (signatures, credentials, security tokens, access keys) from arbitrary free text — an error chain message, or a provider response body that may echo a signed URL — so the text is safe to log.
sanitize_url
Redacts secret query parameters from a URL so it is safe to log or persist.
set_debug_log_listener
Sets or clears the global debug log listener.
try_set_debug_log_listener
Registers a global singleton debug log listener.

Type Aliases§

DebugLogListener
Callback type for global debug log listener.