Skip to content

Commit

Permalink
tink-worker should initialize logger level early
Browse files Browse the repository at this point in the history
  • Loading branch information
displague committed Aug 15, 2020
1 parent 211a0e5 commit f9500b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/tink-worker/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ func initializeDockerClient() (*client.Client, error) {
if err != nil {
return nil, errors.Wrap(err, "DOCKER CLIENT")
}

logger.SetFormatter(&logrus.JSONFormatter{})
return c, nil
}

func initializeLogger() {
level := os.Getenv("WORKER_LOG_LEVEL")
if level != "" {
switch strings.ToLower(level) {
Expand All @@ -301,6 +307,4 @@ func initializeDockerClient() (*client.Client, error) {
logger.SetLevel(logrus.InfoLevel)
logger.Warningln("Variable WORKER_LOG_LEVEL is not set. Default is Info")
}
logger.SetFormatter(&logrus.JSONFormatter{})
return c, nil
}
1 change: 1 addition & 0 deletions cmd/tink-worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var (
)

func main() {
initializeLogger()
logger.Debug("Starting version " + version)
setupRetry()
if setupErr := client.Setup(); setupErr != nil {
Expand Down

0 comments on commit f9500b2

Please sign in to comment.