config#
- class litestar.logging.config.BaseLoggingConfig#
Bases:
ABC
Abstract class that should be extended by logging configs.
- log_exceptions: Literal['always', 'debug', 'never']#
Should exceptions be logged, defaults to log exceptions when
app.debug == True
’
- abstract configure() GetLogger #
Return logger with the given configuration.
- Returns:
A ‘logging.getLogger’ like function.
- class litestar.logging.config.LoggingConfig#
Bases:
BaseLoggingConfig
Configuration class for standard logging.
Notes
If ‘picologging’ is installed it will be used by default.
- version: Literal[1] = 1#
The only valid value at present is 1.
- incremental: bool = False#
Whether the configuration is to be interpreted as incremental to the existing configuration.
Notes
This option is ignored for ‘picologging’
- filters: dict[str, dict[str, Any]] | None = None#
A dict in which each key is a filter id and each value is a dict describing how to configure the corresponding Filter instance.
- propagate: bool = True#
If messages must propagate to handlers higher up the logger hierarchy from this logger.
- handlers: dict[str, dict[str, Any]]#
A dict in which each key is a handler id and each value is a dict describing how to configure the corresponding Handler instance.
- loggers: dict[str, dict[str, Any]]#
A dict in which each key is a logger name and each value is a dict describing how to configure the corresponding Logger instance.
- root: dict[str, dict[str, Any] | list[Any] | str]#
This will be the configuration for the root logger.
Processing of the configuration will be as for any logger, except that the propagate setting will not be applicable.
- log_exceptions: Literal['always', 'debug', 'never']#
Should exceptions be logged, defaults to log exceptions when ‘app.debug == True’
- __init__(version: Literal[1] = 1, incremental: bool = False, disable_existing_loggers: bool = False, filters: dict[str, dict[str, Any]] | None = None, propagate: bool = True, formatters: dict[str, dict[str, Any]] = <factory>, handlers: dict[str, dict[str, Any]] = <factory>, loggers: dict[str, dict[str, Any]] = <factory>, root: dict[str, dict[str, Any] | list[Any] | str] = <factory>, log_exceptions: Literal['always', 'debug', 'never'] = 'debug', traceback_line_limit: int = 20, exception_logging_handler: ExceptionLoggingHandler | None = None) None #
- configure() GetLogger #
Return logger with the given configuration.
- Returns:
A ‘logging.getLogger’ like function.
- class litestar.logging.config.StructLoggingConfig#
Bases:
BaseLoggingConfig
Configuration class for structlog.
Notes
requires
structlog
to be installed.
- __init__(processors: list[Processor] | None = <factory>, wrapper_class: type[BindableLogger] | None = <factory>, context_class: dict[str, Any] | None = None, logger_factory: Callable[..., WrappedLogger] | None = <factory>, cache_logger_on_first_use: bool = True, log_exceptions: Literal['always', 'debug', 'never'] = 'debug', traceback_line_limit: int = 20, exception_logging_handler: ExceptionLoggingHandler | None = None) None #
- log_exceptions: Literal['always', 'debug', 'never']#
Should exceptions be logged, defaults to log exceptions when ‘app.debug == True’
- configure() GetLogger #
Return logger with the given configuration.
- Returns:
A ‘logging.getLogger’ like function.