cloud-sql-proxy icon indicating copy to clipboard operation
cloud-sql-proxy copied to clipboard

refactor: replace zap with slog

Open danielandersson opened this issue 7 months ago • 4 comments
trafficstars

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/zap and go.uber.org/zap/zapcore
  • Added usage of Go's standard library log/slog package
  • Simplified the StdLogger structure by combining infoLog and debugLog into a single stdLog
  • Refactored the StructuredLogger to use slog.Logger instead of Zap's SugaredLogger
  • Modified the NewStructuredLogger function to use slog handlers and configuration
  • Added a new replaceAttr function to maintain compatibility with Google Cloud Logging format
  • Ensured that log messages continue to adhere to the LogEntry format for Google Cloud Logging

danielandersson avatar Apr 04 '25 15:04 danielandersson