Description
The config.Manager currently has TODO comments indicating the need for proper logger injection. Currently, errors are handled silently to avoid using fmt.Printf in production code.
Locations requiring logger injection:
-
Manager.Close() - pkg/config/manager.go:120-123
- Error handling when closing sources
-
startWatching() - pkg/config/manager.go:152-155
- Error handling during configuration reload
-
startWatching() - pkg/config/manager.go:160-163
- Error handling when setting up file watching
Proposed Solution
Add a logger interface to the Manager struct and allow it to be configured through the constructor or a setter method. This would enable proper error logging without using fmt.Printf.
Example Implementation
type Logger interface {
Error(msg string, err error)
Debug(msg string)
}
type Manager struct {
// ... existing fields
logger Logger
}
func (m *Manager) SetLogger(logger Logger) {
m.logger = logger
}
Priority
Low - The current implementation safely handles errors without crashing, but proper logging would improve debugging and monitoring capabilities.
Description
The config.Manager currently has TODO comments indicating the need for proper logger injection. Currently, errors are handled silently to avoid using fmt.Printf in production code.
Locations requiring logger injection:
Manager.Close() - pkg/config/manager.go:120-123
startWatching() - pkg/config/manager.go:152-155
startWatching() - pkg/config/manager.go:160-163
Proposed Solution
Add a logger interface to the Manager struct and allow it to be configured through the constructor or a setter method. This would enable proper error logging without using fmt.Printf.
Example Implementation
Priority
Low - The current implementation safely handles errors without crashing, but proper logging would improve debugging and monitoring capabilities.