Skip to content

refactor(logging): extract shared error-context handling from error and critical (ticket-032) - #90

Merged
tom-sapletta-com merged 2 commits into
mainfrom
ticket/032-logger-error-context
Sep 19, 2026
Merged

tom-sapletta-com merged 2 commits into
mainfrom
ticket/032-logger-error-context

Conversation

@tom-sapletta-com

Copy link
Copy Markdown
Contributor

Summary

Removes the code2llm Data Clump smell (error, message, self repeated across PprefactLogger.error and .critical) by extracting a single _log_with_error_context(level, message, error, **kwargs) helper:

  • error and critical become one-line delegations
  • the duplicated error_type/error_message/traceback context block now lives in one place
  • regression tests added (tests/test_logging.py): context populated for both levels, absent without an exception, extra kwargs preserved

Mirrors the same fix already applied on the ticket/001-cqrs-event-sourcing branch (6faeb59), rebased cleanly onto main.

Verification

  • .venv/bin/python -m pytest tests/ (uv, worktree-local env): 129 passed, 1 skipped (pre-existing diskcache skip; baseline on base was 125 passed + these 4 tests)
  • ruff check src/prefact/logging/ tests/test_logging.py: 13 findings vs 13 on base — no new violations; remaining UP-rule findings pre-date this change
  • No external callers affected (public error/critical signatures unchanged)

Closes #32 (PLF-037)

tom-sapletta-com and others added 2 commits September 19, 2026 16:56
…nd critical (PLF-037)

Co-authored-by: Koru Agent <agent@coru.dev>
…cal (PLF-037)

Co-authored-by: Koru Agent <agent@coru.dev>
@tom-sapletta-com
tom-sapletta-com merged commit a619111 into main Sep 19, 2026
2 checks passed
@tom-sapletta-com
tom-sapletta-com deleted the ticket/032-logger-error-context branch September 19, 2026 17:06
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.

Address code smell: Data Clump: error, message, self

1 participant