Hey!
I’d like to propose adding support for structured logging to the maxprocs package. Currently, logging is implemented using a printf function that accepts a formatted string. While this is convenient, it’s not always sufficient for modern systems where structured logging is required (e.g., JSON format for metrics collection or integration with monitoring systems).
What I’m proposing:
- Add support for structured logging via an interface similar to slog, logrus or zap. For example:
type Logger interface {
Info(msg string, fields map[string]interface{})
Error(msg string, fields map[string]interface{})
}
- Maintain backward compatibility by keeping the ability to use the existing printf method. This can be achieved by introducing a new option, StructuredLogger:
func StructuredLogger(logger Logger) Option {
return optionFunc(func(cfg *config) {
cfg.structuredLogger = logger
})
}
- If no structured logger is set, continue using printf as it currently works.
Why this matters:
- Structured logs are easier to analyze and integrate with monitoring systems.
- This would make the package more flexible and modern without breaking existing functionality.
I'm ready to make a PR with these changes. What do you think?
Hey!
I’d like to propose adding support for structured logging to the maxprocs package. Currently, logging is implemented using a printf function that accepts a formatted string. While this is convenient, it’s not always sufficient for modern systems where structured logging is required (e.g., JSON format for metrics collection or integration with monitoring systems).
What I’m proposing:
Why this matters:
I'm ready to make a PR with these changes. What do you think?