Skip to content

fix: Remove unused logging code#186

Merged
khvn26 merged 5 commits intomainfrom
feat/logging-improvements-pt2
Mar 30, 2026
Merged

fix: Remove unused logging code#186
khvn26 merged 5 commits intomainfrom
feat/logging-improvements-pt2

Conversation

@khvn26
Copy link
Copy Markdown
Member

@khvn26 khvn26 commented Mar 30, 2026

In this PR, we:

  1. Remove JsonFormatter which is no longer used.
  2. Remove _SentryFriendlyProcessorFormatter since it's deemed redundant — Sentry is able to handle event deduplication when structlog.stdlib.ProcessorFormatter is used (as proven by new tests).

@khvn26 khvn26 requested a review from a team as a code owner March 30, 2026 10:56
@khvn26 khvn26 requested review from Zaimwa9 and removed request for a team March 30, 2026 10:56
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.47%. Comparing base (7c65cd9) to head (43f11ca).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #186      +/-   ##
==========================================
- Coverage   96.48%   96.47%   -0.01%     
==========================================
  Files          97       97              
  Lines        3553     3543      -10     
==========================================
- Hits         3428     3418      -10     
  Misses        125      125              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@emyller emyller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking questions.

khvn26 added 5 commits March 30, 2026 18:17
…uilt-in record copy

structlog >=24.1 makes a shallow copy of the LogRecord in
ProcessorFormatter.format(), so the original msg, args, and exc_info
are preserved for Sentry's LoggingIntegration hook. No need to
snapshot/restore them ourselves.

- Inline formatter construction into setup_structlog()
- Use pass_foreign_args=True for gunicorn access processor
- Add format_exc_info to foreign_pre_chain for stdlib logs
- Strip positional_args in map_event_to_json_record
- Assert exact tracebacks and Sentry events in tests
No production consumer — all JSON formatting goes through
map_event_to_json_record via structlog's ProcessorFormatter.
JsonRecord TypedDict stays as the schema definition.
@khvn26 khvn26 force-pushed the feat/logging-improvements-pt2 branch from f9e1fd2 to 43f11ca Compare March 30, 2026 17:17
@khvn26 khvn26 requested a review from emyller March 30, 2026 17:18
@khvn26 khvn26 merged commit 9539d4f into main Mar 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants