<#3842 feat: Log warnings as structured records vi...
# meltano-repo-activity
g
#3842 feat: Log warnings as structured records via the `singer_sdk.warnings` logger Pull request opened by edgarrmondragon Summary • Replace
logging.captureWarnings
with a custom
warnings.showwarning
hook (
_setup_warning_logging
) that logs to the
singer_sdk.warnings
logger. • Warnings now render as a single line in console logs (
DeprecationWarning: msg
) and, with structured logging, carry
warning_category
and
warning_source
in
extra
. • Previously warnings went to
py.warnings
as a preformatted multi-line string. Log configs targeting that logger by name should switch to
singer_sdk.warnings
. Test plan •
uv run pytest tests/core
• New test:
tests/core/test_warning_logging.py
Summary by Sourcery Emit plugin warnings as structured logging records through the dedicated
singer_sdk.warnings
logger. New Features: • Route Python warnings through the
singer_sdk.warnings
logger as single-line records with structured category and source metadata. Bug Fixes: • Prevent warning records from being silently dropped when logging configurations disable existing loggers. Enhancements: • Restore the previous warning hook after plugin command execution and preserve it across repeated setup calls. Documentation: • Document the requirement to run typing checks after code changes. Tests: • Add coverage for structured warning fields, reversible hook setup, and warning persistence under logger-disabling configurations. meltano/sdk