Skip to content

Comments

refactor: logging configuration to require Settings instance#1031

Merged
gcharest merged 1 commit intomainfrom
feat/infra_logging_config
Jan 8, 2026
Merged

refactor: logging configuration to require Settings instance#1031
gcharest merged 1 commit intomainfrom
feat/infra_logging_config

Conversation

@gcharest
Copy link
Contributor

@gcharest gcharest commented Jan 8, 2026

Summary | Résumé

This pull request refactors the logging setup in the infrastructure layer to require explicit passing of a Settings instance when configuring logging, removes the deprecated module-level logger, and updates tests and fixtures to support these changes. The main goals are to improve clarity, enforce best practices, and modernize the codebase by removing legacy patterns.

Logging Setup Refactor:

  • The configure_logging function in setup.py now requires a settings parameter instead of implicitly fetching it, improving explicitness and testability. [1] [2]
  • Removed the deprecated module-level logger from setup.py and __init__.py, encouraging direct use of structlog.get_logger() in new code. [1] [2] [3]
  • Updated the deprecated get_module_logger function to use structlog.get_logger() directly, removing reliance on the old module-level logger. [1] [2]

Testing and Fixtures Updates:

  • Added new mock_settings fixtures to conftest.py files for unit tests, allowing tests to pass a mock Settings instance to configure_logging. [1] [2]
  • Refactored all relevant unit tests to use the new mock_settings fixture and explicitly pass settings to configure_logging, ensuring compatibility with the updated API. [1] [2] [3] [4] [5] [6] [7]

These changes modernize the logging setup and make the codebase easier to maintain and test.

@gcharest gcharest requested a review from a team January 8, 2026 22:18
@gcharest gcharest self-assigned this Jan 8, 2026
@gcharest gcharest merged commit 465349b into main Jan 8, 2026
9 checks passed
@gcharest gcharest deleted the feat/infra_logging_config branch January 8, 2026 22:23
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.

2 participants