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

@@ -2,6 +2,7 @@ package network
import (
"github.com/google/uuid"
"github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/proxy"
"github.com/unistack-org/micro/v3/router"
"github.com/unistack-org/micro/v3/tunnel"
@@ -27,6 +28,8 @@ type Options struct {
Router router.Router
// Proxy is network proxy
Proxy proxy.Proxy
// Logger
Logger logger.Logger
}
// Id sets the id of the network node
@@ -85,6 +88,13 @@ func Proxy(p proxy.Proxy) Option {
}
}
// Logger sets the network logger
func Logger(l logger.Logger) Option {
return func(o *Options) {
o.Logger = l
}
}
// DefaultOptions returns network default options
func DefaultOptions() Options {
return Options{