tpcp.misc.WarningErrorContext#

class tpcp.misc.WarningErrorContext(name: str, context: dict[str, Any] | None = None, *, context_provider: Callable[[], Mapping[str, Any]] | None = None, record_only: bool = False)[source]#

A warning/error context and its persistent event records.

Attributes:
records

Events observed while the context was active. Events from nested contexts are included with their fully rendered context stack.

Methods

start()

Activate the context and return this object.

stop()

Deactivate the context without recording an exception.

start() WarningErrorContext[source]#

Activate the context and return this object.

Use the context-manager form when exceptions must be recorded and annotated reliably.

stop() None[source]#

Deactivate the context without recording an exception.