This commit is contained in:
withchao 2023-06-20 14:48:53 +08:00
parent df888d22e7
commit e66b474ab9

View File

@ -18,6 +18,10 @@ const (
timeout = 5 timeout = 5
) )
type Logger interface {
Printf(string, ...interface{})
}
type ZkClient struct { type ZkClient struct {
zkServers []string zkServers []string
zkRoot string zkRoot string
@ -40,7 +44,7 @@ type ZkClient struct {
balancerName string balancerName string
RoundRobin RoundRobin
logger *log.ZkLogger logger Logger
} }
type ZkOption func(*ZkClient) type ZkOption func(*ZkClient)
@ -76,7 +80,7 @@ func WithTimeout(timeout int) ZkOption {
} }
} }
func WithLogger(logger *log.ZkLogger) ZkOption { func WithLogger(logger Logger) ZkOption {
return func(client *ZkClient) { return func(client *ZkClient) {
client.logger = logger client.logger = logger
} }