cmem_client.models.logging_config¤
Models for the configuration of the logging module
Client.configure_logging_from_dict() and configure_logging_from_json() validate
their input against these models before handing it to logging.config.dictConfig(),
so a malformed logging configuration is rejected with a readable error instead of
failing inside the standard library. The models mirror the dictConfig schema and allow
extra keys, so anything dictConfig understands stays usable.
Classes:
- FormatterConfig – Formatter configuration.
- HandlerConfig – Handler configuration.
- LoggerConfig – Logger configuration.
- LoggingConfig – Logging configuration. Allows for extra fields but validates the most common fields.
Attributes:
- LogLevel – Levels accepted in a logging configuration, including the client’s own
TRACE.
FormatterConfig¤
Bases: BaseModel
Formatter configuration.
Attributes:
- format (
str) – Format string of the log records, e.g."%(asctime)s - %(name)s - %(levelname)s - %(message)s". - datefmt (
str | None) – Format string for the timestamp, orNonefor the default.
datefmt¤
format¤
HandlerConfig¤
Bases: BaseModel
Handler configuration.
Attributes:
- class_ (
str) – Dotted path of the handler class, e.g.logging.StreamHandler. Written asclassin the configuration itself. - level (
LogLevel | None) – Lowest level this handler emits, orNoneto inherit from the logger. - formatter (
str | None) – Name of the formatter to use, referring to a key offormatters. - filename (
str | None) – File the handler writes to, for the file based handlers.
class_¤
filename¤
formatter¤
level¤
LogLevel¤
Levels accepted in a logging configuration, including the client’s own TRACE.
LoggerConfig¤
Bases: BaseModel
Logger configuration.
Attributes:
- level (
LogLevel | None) – Lowest level this logger passes on, e.g.DEBUG. - handlers (
list[str] | None) – Names of the handlers to attach, referring to keys ofhandlers.
handlers¤
level¤
LoggingConfig¤
Bases: BaseModel
Logging configuration. Allows for extra fields but validates the most common fields.
Attributes:
- version (
int) – Schema version of the configuration. dictConfig only knows1, and anything else is rejected. - disable_existing_loggers (
bool) – Whether loggers which already exist are switched off. Setting this silences libraries that configured logging before the client. - formatters (
dict[str, FormatterConfig] | None) – Formatters of the configuration, keyed by name. - handlers (
dict[str, HandlerConfig] | None) – Handlers of the configuration, keyed by name. - loggers (
dict[str, LoggerConfig] | None) – Loggers of the configuration, keyed by logger name. Configurecmem_client.clientto cover the whole library at once. - root (
LoggerConfig | None) – Configuration of the root logger.
Functions:
- check_version – Ensure version is always 1.
check_version¤
Ensure version is always 1.