Skip to content
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

support replace go-kit Logger with zap Logger Using Adapter Pattern #281

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lunuan
Copy link

@lunuan lunuan commented Jun 6, 2024

Description:

This pull request replaces the default go-kit Logger with zap Logger by implementing an Adapter pattern. This change aims to leverage the high-performance and structured logging capabilities of zap Logger while maintaining compatibility with the existing logging interface used in the project.

Changes:

Implemented Adapter Pattern, created a new adapter to wrap zap Logger and conform to the go-kit Logger interface. This ensures that all logging calls through the existing interface are seamlessly routed to zap Logger.

Example:

Here is an example of how the logging call has been adapted:

import (
  consumerLibrary "github.com/aliyun/aliyun-log-go-sdk/consumer"
)

var zapLogger *zap.Logger
var consumerWorker consumerLibrary.ConsumerWorker

// ...omit init consumerWorker
consumerWorker.UseZapLogger(zapLogger)

Conclusion:

This change improves the logging capabilities of the project by integrating zap Logger while maintaining compatibility with the existing logging interface through the Adapter pattern. This enhancement provides better performance and structured logging support.

@CLAassistant
Copy link

CLAassistant commented Jun 6, 2024

CLA assistant check
All committers have signed the CLA.

@crimson-gao crimson-gao self-requested a review September 6, 2024 09:12
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.

2 participants