better better logging
This commit is contained in:
+10
-5
@@ -9,7 +9,11 @@ import (
|
|||||||
"github.com/oklog/run"
|
"github.com/oklog/run"
|
||||||
"github.com/owncloud/ocis-accounts/pkg/config"
|
"github.com/owncloud/ocis-accounts/pkg/config"
|
||||||
"github.com/owncloud/ocis-accounts/pkg/micro/grpc"
|
"github.com/owncloud/ocis-accounts/pkg/micro/grpc"
|
||||||
olog "github.com/owncloud/ocis-pkg/v2/log"
|
oclog "github.com/owncloud/ocis-pkg/v2/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
logger oclog.Logger
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server is the entry point for the server command.
|
// Server is the entry point for the server command.
|
||||||
@@ -60,16 +64,17 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
Destination: &cfg.Server.Address,
|
Destination: &cfg.Server.Address,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Before: func(c *cli.Context) error {
|
||||||
|
logger = oclog.NewLogger(oclog.Name(cfg.Server.Name))
|
||||||
|
return nil
|
||||||
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
gr := run.Group{}
|
gr := run.Group{}
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
l := olog.NewLogger(
|
|
||||||
olog.Name(cfg.Server.Name),
|
|
||||||
)
|
|
||||||
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
service := grpc.NewService(
|
service := grpc.NewService(
|
||||||
grpc.Logger(l),
|
grpc.Logger(logger),
|
||||||
grpc.Context(ctx),
|
grpc.Context(ctx),
|
||||||
grpc.Config(cfg),
|
grpc.Config(cfg),
|
||||||
grpc.Name(cfg.Server.Name),
|
grpc.Name(cfg.Server.Name),
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ type Store struct {
|
|||||||
// New creates a new store
|
// New creates a new store
|
||||||
func New(cfg *config.Config) account.Manager {
|
func New(cfg *config.Config) account.Manager {
|
||||||
s := Store{
|
s := Store{
|
||||||
Logger: olog.NewLogger(olog.Name("ocis-accounts")),
|
Logger: olog.NewLogger(olog.Name(cfg.Server.Name)),
|
||||||
}
|
}
|
||||||
|
|
||||||
dest := filepath.Join(cfg.MountPath, StoreName)
|
dest := filepath.Join(cfg.MountPath, StoreName)
|
||||||
|
|||||||
Reference in New Issue
Block a user