Skip to content

refactor: replace zap with slog #2421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danielandersson
Copy link

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 danielandersson requested a review from a team as a code owner April 4, 2025 15:07
@jackwotherspoon
Copy link
Collaborator

Thanks @danielandersson 👏

I will take a look at this in the coming days 😄

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.

Replace zap with log/slog
3 participants