Skip to content

Conversation

@Mewbi
Copy link
Member

@Mewbi Mewbi commented Jan 25, 2026

This pull request introduces a unified structured logging approach across the codebase by integrating the zap logger. It replaces all previous usage of the standard log and fmt for logging with structured logging calls, injects the logger into major components using dependency injection, and updates dependencies to use the latest version of zap. Additionally, it refactors middleware and handler functions to use the logger for error reporting and operational messages.

Structured Logging Integration

  • Introduced a new NewLogger function in config/logger.go to create a zap.Logger instance based on the environment (development or production).
  • Updated all major components (internal/server/server.go, internal/repository/sqlite.go, internal/repository/websocket.go, internal/schedule/schedule.go) to accept and use a *zap.Logger via dependency injection, replacing all previous log and fmt error logging with structured zap calls.

Error Handling and Middleware Refactor

  • Refactored all error handling in HTTP handlers and WebSocket methods to use zap.Logger, providing more structured and informative logs.
  • Refactored middleware functions in internal/server/server.go to be methods on the Controller struct, allowing them to access the injected logger and configuration.

Code Cleanliness

  • Removed unused imports of log and fmt where logging is now handled by zap.

@Mewbi Mewbi merged commit 289233e into master Jan 25, 2026
2 checks passed
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.

1 participant