Skip to content

Commit

Permalink
Merge branch 'develop' into style/imports-fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
williamfeng323 authored Aug 1, 2021
2 parents 64514d3 + 64a1e21 commit 14f3fc2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion cmd/pixiu/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,15 @@ var (
flagLogLevel := c.String("log-level")
logConfPath := c.String("log-config")

err := logger.InitLog(logConfPath)
if err != nil {
return err
}

bootstrap := config.Load(configPath)
if logLevel, ok := flagToLogLevel[flagLogLevel]; ok {
logger.SetLoggerLevel(logLevel)
}
logger.InitLog(logConfPath)

initFromRemote := false
if bootstrap.GetAPIMetaConfig() != nil {
Expand Down
11 changes: 7 additions & 4 deletions pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,13 @@ type Logger interface {
}

func init() {
logConfFile := "./conf/log.yml"
err := InitLog(logConfFile)
if err != nil {
logger.Infof("[InitLog] warn: %v", err)
// TODO: Reserve for testing, using a better way?
if logger == nil {
logConfFile := "./conf/log.yml"
err := InitLog(logConfFile)
if err != nil {
logger.Infof("[InitLog] warn: %v", err)
}
}
}

Expand Down

0 comments on commit 14f3fc2

Please sign in to comment.