Skip to main content
Logging settings + setup, co-located with the logging util. Side-effect-free on import: the consumer calls setup_logging(...) explicitly (e.g. at app startup) — importing this package configures nothing on its own.

AccessLogQueryMaskingFilter

tai42_kit.logging.logger.AccessLogQueryMaskingFilter
Mask every query-string value in the uvicorn.access request line. The access formatter REBUILDS the line from record.args — a 5-tuple whose third element is the request path + query — and ignores a rewritten record.msg, so the mask is applied by replacing that args element; masking the message alone silently no-ops. Non-matching records pass through untouched. Always returns True — this filter redacts, it never drops.

Members

filter

tai42_kit.logging.logger.AccessLogQueryMaskingFilter.filter
Mask the request path in a matching access record and always keep the record. Parameters

LoggingSettings

tai42_kit.logging.settings.LoggingSettings
Process logging configuration sourced from TAI_-prefixed environment variables. Attributes

Members

validate_log_level

tai42_kit.logging.settings.LoggingSettings.validate_log_level
Normalise log_level to upper case, raising when it is not a known level name. Parameters

is_enabled_for

tai42_kit.logging.settings.LoggingSettings.is_enabled_for
Whether the configured level would emit a record logged at level_name. Parameters

logging_settings

tai42_kit.logging.settings.logging_settings
Return the cached LoggingSettings instance.

setup_logging

tai42_kit.logging.logger.setup_logging
Configure the ROOT logger for an application. Call this from application startup only — never on library import, since it reconfigures the process-global root logger. force=True replaces the existing root handlers, so a repeat call (e.g. after a settings reload) applies the new level instead of being silently ignored. The uvicorn.access logger’s request line carries the full request URL — including query-string capability codes and opaque params — so it is fitted with a masking filter that redacts every query VALUE before the line is formatted. The attach is idempotent: a repeat call never stacks a second filter. Parameters