Skip to content

xtr_logging_contracts.exception

The errors the contract itself can raise.

Only two live here, because only two can be raised by the contract rather than by an implementation: :class:LoggingError, the root every logging error derives from — including every one xtr-logging adds — and :class:InvalidLevelError, which :meth:Level.parse raises. Catching :class:LoggingError therefore catches anything logging can go wrong with, whichever package raised it.

InvalidLevelError

InvalidLevelError(value: object)

Bases: LoggingError, ValueError

A value names no log level.

Also a :class:ValueError, which is what lets a configuration parser report the field that held it.

Record the value that could not be read as a level.

LoggingError

Bases: Exception

Base class for every error raised by this library.

Catch this to handle anything logging can go wrong with; catch a subclass to handle one cause. Every subclass carries the data a caller needs as typed attributes and composes its own message from them.