setup_logging(...) and
install_record_redaction(...) explicitly (e.g. at app startup), and a feature
registers its own redaction patterns — importing this package configures nothing.
REDACTOR_FAILED
tai42_kit.logging.redaction.REDACTOR_FAILED
TRANSPORT_LOGGERS
tai42_kit.logging.redaction.TRANSPORT_LOGGERS
URL_REDACTION
tai42_kit.logging.redaction.URL_REDACTION
AccessLogQueryMaskingFilter
tai42_kit.logging.logger.AccessLogQueryMaskingFilter
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
LoggingSettings
tai42_kit.logging.settings.LoggingSettings
TAI_-prefixed environment variables.
Attributes
Members
validate_log_level
tai42_kit.logging.settings.LoggingSettings.validate_log_level
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
level_name.
Parameters
RecordScope
tai42_kit.logging.redaction.RecordScope
install_record_redaction
tai42_kit.logging.redaction.install_record_redaction
logging.getLogRecordFactory().
"tai" scrubs the tai logger family (tai, mcp, fastmcp and names
starting tai42_, tai42., tai., mcp., fastmcp.), so an embedding
host’s own records pass untouched; "process" scrubs every record. The scope
only widens: a later "tai" install never narrows "process". Idempotent:
the wrapper is tagged and a repeat install chains nothing.
Parameters
logging_settings
tai42_kit.logging.settings.logging_settings
LoggingSettings instance.
redact_url_userinfo
tai42_kit.logging.redaction.redact_url_userinfo
scheme://user:pass@host/… -> scheme://***@host/….
The authority ends at the first /, ? or #; the userinfo runs to its
last @, so an @ inside a password cannot leak. A string with no ://
or no @ in its authority is returned unchanged.
Parameters
redact_urls_in_text
tai42_kit.logging.redaction.redact_urls_in_text
***.
Non-URL text is left untouched.
Parameters
register_record_redactor
tai42_kit.logging.redaction.register_record_redactor
name) a redactor the record factory applies to in-scope records.
Registration alone installs nothing; install_record_redaction chains the
factory. Raises ValueError when markers is empty or holds anything but a
non-empty string.
Parameters
register_transport_redaction
tai42_kit.logging.redaction.register_transport_redaction
name) a redactor for the TRANSPORT_LOGGERS records.
Installs, once, one filter on each transport logger that applies every
registered transport redactor. Raises ValueError when markers is empty or
holds anything but a non-empty string.
Parameters
setup_logging
tai42_kit.logging.logger.setup_logging
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 httpx logger’s own
request-line log carries the full outbound URL, credentials included, so it is fitted
with a filter that strips the path and query, leaving only the origin. Both attaches are
idempotent: a repeat call never stacks a second filter.
Logging’s child-side fork hook
(install_logging_fork_safety) is registered here,
once per process, so a child forked while another thread writes a log line gets its own
streams.
Parameters

