Skip to content

Conversation

@jhw-db
Copy link
Contributor

@jhw-db jhw-db commented Oct 30, 2025

Summary

This pull request adds a logging system for synchronous and asynchronous logging. It is designed to be easily enhanced by a translator (i18n) and an issue tracker by using a protocols pattern. A structured logger along with different file formatters and log rotation are readily available. Refer to the provided README.md for an overview of features and how to use it.

Formatting changes: logging & Internationalizierung

Updated all logger calls to structured format with translate=True; all ConfigurationError messages wrapped with _() using named parameters; added exc_info=True to all error logs; renamed loop variables from _ to _idx to avoid shadowing i18n function

Added logging to validate() method; translated all ValidationIssue messages and print_summary messages with _(); added exc_info=True to error logs

Related Issues/Tickets

#84

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Test improvement
  • Other (please describe):

How Has This Been Tested?

Unit tests have to be added to ensure a coverage of 100% taking also edge cases into account.

Checklist

  • Follows conventional commit message format
  • Code is formatted and linted (uv run ruff format . && uv run ruff check .)
  • All tests pass (uv run pytest)
  • Documentation updated (if needed)

Additional Notes

The logger can make use of the i18n system provided in #119. Currently the validation of the configuration context has an own implementaiton of error handling and validation stacking. This will be tackled in another PR

During fixing of the liniting errors it was found that Ruff and MyPy
collide for the decorators.py file. Ruff remove the call of settattr
and assigns the value directly to attribute, while MyPy prefers the use
of settattr. Therefore, the related rule of Ruff is deactivated for the
file.
- Add synchronous and asynchronous logging APIs with identical interfaces
- Implement JSON and human-readable formatters with UTC timestamps
- Support structured data logging via keyword arguments
- Add protocol-based dependency injection for issue tracking and i18n
- Implement automatic field extraction from Issue and IssueCollector objects
- Add file handlers with automatic directory creation and rotation
- Support per-message translation control across all formatters
- Add validation summary logging with issue collector integration
@jhw-db jhw-db changed the title Add logging system Draft: Add logging system Nov 3, 2025
HHG-DB and others added 4 commits November 4, 2025 15:42
- Add synchronous and asynchronous logging APIs with identical interfaces
- Implement JSON and human-readable formatters with UTC timestamps
- Support structured data logging via keyword arguments
- Add protocol-based dependency injection for issue tracking and i18n
- Implement automatic field extraction from Issue and IssueCollector objects
- Add file handlers with automatic directory creation and rotation
- Support per-message translation control across all formatters
- Add validation summary logging with issue collector integration
# Conflicts:
#	popupsim/backend/src/core/logging/formatters.py
#	popupsim/backend/src/core/logging/logger.py
#	popupsim/backend/src/main.py
#	popupsim/backend/tests/unit/core/logging/test_async_logger.py
#	popupsim/backend/tests/unit/core/logging/test_handlers.py
#	popupsim/backend/tests/unit/core/logging/test_logger.py
@HHG-DB HHG-DB linked an issue Nov 4, 2025 that may be closed by this pull request
5 tasks
@HHG-DB HHG-DB requested a review from 36b498c8 November 4, 2025 15:04
@36b498c8 36b498c8 requested a review from HHG-DB November 10, 2025 07:35
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.

Story 3.8: Fehlerbehandlung & Logging

3 participants