-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: provides logging and hook support for redis #74
Conversation
pkg/base/client/cache.go
Outdated
@@ -31,11 +33,17 @@ func NewRedisClient(db int) (*redis.Client, error) { | |||
if config.Redis == nil { | |||
return nil, errors.New("redis config is nil") | |||
} | |||
|
|||
l := logger.GetRedisLogger() | |||
redis.SetLogger(l) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个setlogger在new之前不会有问题么?
我没有注意到还有这个logger,想问一下这个和我们hook有什么区别?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一个进程只会有一个loggerObj,其他的任何logger都是对他的封装。RedisLogger也一样,只是加了四个方法来满足redis定义的接口
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
client中没有logger对象,client的日志输出就是调用的全局logger,所以不会有问题
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不是啊,我是想问你 new 这个对象之前就 setlogger 了,会不会有点问题?需要放到后面吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不会有问题。但是在逻辑上确实应该放在初始化之后,改了
LGTM |
你新的 commit 还是没有签名 |
有了有了 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.