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,8 @@ package store
import (
"context"
"time"
"github.com/unistack-org/micro/v3/logger"
)
// Options contains configuration for the Store
@@ -15,6 +17,8 @@ type Options struct {
Database string
// Table is analag for a table in database backends or a key prefix in KV backends
Table string
// Logger
Logger logger.Logger
// Context should contain all implementation specific options, using context.WithValue.
Context context.Context
}
@@ -22,6 +26,13 @@ type Options struct {
// Option sets values in Options
type Option func(o *Options)
// Logger sets the logger
func Logger(l logger.Logger) Option {
return func(o *Options) {
o.Logger = l
}
}
// Nodes contains the addresses or other connection information of the backing storage.
// For example, an etcd implementation would contain the nodes of the cluster.
// A SQL implementation could contain one or more connection strings.