Skip to content

refactor: migrate logging calls to stdlib logging.getLogger() pattern #122

Description

@kvithayathil

Context

The codebase uses structlog.get_logger(__name__) directly in 35+ files. The idiomatic structlog pattern is to call logging.getLogger(__name__) (stdlib) with structlog's ProcessorFormatter handling formatting underneath. This decouples callers from structlog entirely — they only import logging, and structlog configuration is centralized.

Task

  1. Enable structlog.stdlib.LoggerFactory() in configure_logger() (currently commented out at app_logger.py:109)
  2. Ensure ProcessorFormatter is wired for all stdlib log handlers
  3. Replace structlog.get_logger(__name__)logging.getLogger(__name__) across all 35+ files
  4. Replace from app.utils.app_logger import loggerlogging.getLogger(__name__) (2 files)
  5. Update AppLogger class to use stdlib-first pattern internally
  6. Run full test suite + basedpyright to verify no regressions

Acceptance Criteria

  • All callers use logging.getLogger(__name__) — zero direct structlog imports in application code
  • structlog configuration remains in app_logger.py only
  • All 1213+ tests pass
  • basedpyright clean

Files

  • app/logger_config/app_logger.py — enable LoggerFactory, fix configuration
  • 35+ files across app/ — replace import pattern
  • app/utils/app_logger.py — update or remove shared logger

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backendBackend (Python/FastAPI) changesdevexDeveloper and contributor experienceenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions