Skip to content

Add logging for repository, service, and controller #71

@gabor-boros

Description

@gabor-boros

⚠️ Blocked on #261

Description

Expand logging coverage across the repository, service, and controller layers while maintaining clarity and avoiding duplication.

Logging exists in the project, but many parts of the codebase still lack proper log statements. To be effective, logging should:

  • Use appropriate log levels.
  • Avoid excessive or redundant logs.
  • Be placed as low in the call stack as possible (closest to where the event happens).
  • Never duplicate log entries for the same event.

Guidelines

  1. Log Levels
    • Error → Failures, unexpected exceptions, and critical issues.
    • Debug → Successful operations, diagnostic details, and development insights.
  2. Placement
    • Log at the lowest relevant level in the codebase (e.g., repository for DB issues).
    • Avoid logging the same event at higher levels unless absolutely necessary.
  3. Avoid Over-Logging
    • Do not log trivial successes (e.g., “validation successful”).
    • Only log what’s useful for understanding system behavior or diagnosing issues.

Example

Good:

  • At the repository level:
    • Log DB query failures at error level.
    • Log successful DB operations at debug level.

Avoid:

  • Logging repository errors again at the service level.
  • Logging that a basic validation passed.

Tasks

  1. Identify repository, service, and controller functions without logging.
  2. Add logging following the guidelines above.
  3. Ensure no duplication of logs between layers.
  4. Test logging output to verify clarity and usefulness.
  5. Update unit tests for expecting log lines

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions