refactor: replace zap with slog
This PR replaces the third-party Zap logging library with Go's standard library slog package for structured logging. This change reduced the number of dependencies while maintaining the same logging functionality and format.
Fixes #2120
Changes
- Removed dependencies on
go.uber.org/zapandgo.uber.org/zap/zapcore - Added usage of Go's standard library
log/slogpackage - Simplified the
StdLoggerstructure by combininginfoLoganddebugLoginto a singlestdLog - Refactored the
StructuredLoggerto useslog.Loggerinstead of Zap'sSugaredLogger - Modified the
NewStructuredLoggerfunction to usesloghandlers and configuration - Added a new
replaceAttrfunction to maintain compatibility with Google Cloud Logging format - Ensured that log messages continue to adhere to the LogEntry format for Google Cloud Logging
Thanks @danielandersson 👏
I will take a look at this in the coming days 😄
@hessjcg mind taking a look at this one?
Also @enocom you might also want to take a look as a similar change would probably be added to AlloyDB Proxy 😄
Some minor style nits. Otherwise LGTM.
@hessjcg we should manually verify the before and after logs just to be certain this doesn't break the existing structured logging. I think it's correct, but better to double check.
Thanks for the review, all of your feedback should have been addressed with 0946cd0c922c7e0d24912087bc9469e497f42e78.
/gcbrun
/gcbrun