@ -8,6 +8,7 @@ import (
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/registry"
"google.golang.org/grpc/resolver"
)
@ -37,11 +38,19 @@ func WithInsecure(insecure bool) Option {
}
}
// DisableDebugLog disables update instances log.
func DisableDebugLog ( ) Option {
return func ( b * builder ) {
b . debugLogDisabled = true
}
}
type builder struct {
discoverer registry . Discovery
logger log . Logger
timeout time . Duration
insecure bool
debugLogDisabled bool
}
// NewBuilder creates a builder which is used to factory registry resolvers.
@ -51,6 +60,7 @@ func NewBuilder(d registry.Discovery, opts ...Option) resolver.Builder {
logger : log . GetLogger ( ) ,
timeout : time . Second * 10 ,
insecure : false ,
debugLogDisabled : false ,
}
for _ , o := range opts {
o ( b )
@ -85,6 +95,7 @@ func (b *builder) Build(target resolver.Target, cc resolver.ClientConn, opts res
cancel : cancel ,
log : log . NewHelper ( b . logger ) ,
insecure : b . insecure ,
debugLogDisabled : b . debugLogDisabled ,
}
go r . watch ( )
return r , nil