diff --git a/accounts/pkg/command/root.go b/accounts/pkg/command/root.go index 731cf37749..17d17364c8 100644 --- a/accounts/pkg/command/root.go +++ b/accounts/pkg/command/root.go @@ -75,6 +75,7 @@ func NewLogger(cfg *config.Config) log.Logger { log.Level(cfg.Log.Level), log.Pretty(cfg.Log.Pretty), log.Color(cfg.Log.Color), + log.File(cfg.Log.File), ) } @@ -133,6 +134,7 @@ func NewSutureService(cfg *ociscfg.Config) suture.Service { if cfg.Mode == 0 { cfg.Accounts.Supervised = true } + cfg.Accounts.Log.File = cfg.Log.File return SutureService{ cfg: cfg.Accounts, } diff --git a/accounts/pkg/config/config.go b/accounts/pkg/config/config.go index 530aefca79..8863919429 100644 --- a/accounts/pkg/config/config.go +++ b/accounts/pkg/config/config.go @@ -62,6 +62,7 @@ type Log struct { Level string Pretty bool Color bool + File string } // Repo defines which storage implementation is to be used. diff --git a/accounts/pkg/flagset/flagset.go b/accounts/pkg/flagset/flagset.go index a4a0aaf61f..9542d75c32 100644 --- a/accounts/pkg/flagset/flagset.go +++ b/accounts/pkg/flagset/flagset.go @@ -34,6 +34,12 @@ func RootWithConfig(cfg *config.Config) []cli.Flag { // ServerWithConfig applies cfg to the root flagset func ServerWithConfig(cfg *config.Config) []cli.Flag { return []cli.Flag{ + &cli.StringFlag{ + Name: "log-file", + Usage: "Enable log to file", + EnvVars: []string{"ACCOUNTS_LOG_FILE", "OCIS_LOG_FILE"}, + Destination: &cfg.Log.File, + }, &cli.BoolFlag{ Name: "tracing-enabled", Usage: "Enable sending traces",