add logger to options

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-08-29 17:44:49 +03:00
parent 2382446e10
commit 53654185ba
16 changed files with 239 additions and 48 deletions

View File

@@ -5,6 +5,7 @@ import (
"crypto/tls"
"github.com/unistack-org/micro/v3/codec"
"github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/registry"
)
@@ -13,6 +14,8 @@ type Options struct {
Secure bool
Codec codec.Marshaler
// Logger
Logger logger.Logger
// Handler executed when errors occur processing messages
ErrorHandler Handler
@@ -145,6 +148,13 @@ func TLSConfig(t *tls.Config) Option {
}
}
// Logger sets the logger
func Logger(l logger.Logger) Option {
return func(o *Options) {
o.Logger = l
}
}
// SubscribeContext set context
func SubscribeContext(ctx context.Context) SubscribeOption {
return func(o *SubscribeOptions) {