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

@@ -3,6 +3,7 @@ package proxy
import (
"github.com/unistack-org/micro/v3/client"
"github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/router"
)
@@ -16,6 +17,8 @@ type Options struct {
Router router.Router
// Extra links for different clients
Links map[string]client.Client
// Logger
Logger logger.Logger
}
// Option func signature
@@ -42,6 +45,13 @@ func WithRouter(r router.Router) Option {
}
}
// WithLogger specifies the logger to use
func WithLogger(l logger.Logger) Option {
return func(o *Options) {
o.Logger = l
}
}
// WithLink sets a link for outbound requests
func WithLink(name string, c client.Client) Option {
return func(o *Options) {