Skip to content

Inconsistent logging: mix of print() and logging module #210

@shenxianpeng

Description

@shenxianpeng

Description

Logging output is inconsistent across the project:

  • main.py, report_creator.py, utils.py use print()
  • ai_summarizer.py, ai_providers.py use logging.getLogger()

This leads to:

  1. No unified control over log levels (debug/warning/error)
  2. Unable to redirect log output
  3. AI module log format is inconsistent with print output
  4. Some "Warning" messages go through print, potentially polluting stdJSON and other formatted output

Proposed Fix

  1. Use the logging module consistently across all modules
  2. Configure logging handler in main() (console output via StreamHandler, configurable level)
  3. Replace existing print() calls with appropriate logger.info() / logger.warning() / logger.error()
  4. Add --verbose / --quiet CLI arguments

Affected Code

  • gitstats/main.py: numerous print() calls
  • gitstats/utils.py: print in get_pipe_output()
  • gitstats/report_creator.py: no direct print, but print_header etc. are HTML output (not relevant)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions