Skip to content

Commit

Permalink
Make INFO default logging level
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Martens <[email protected]>
Co-authored-by: Maryan Hratson <[email protected]>
  • Loading branch information
3 people committed Sep 13, 2019
1 parent 30db4f8 commit 42ba4e2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/term-check/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package main

import (
"flag"
"os"

"github.com/rs/zerolog"
"github.com/rs/zerolog/log"

Expand All @@ -11,11 +13,19 @@ import (
)

var filepath = flag.String("config", "config.yaml", "Location of the configuration file.")
var debug = flag.Bool("debug", os.Getenv("LOG_LEVEL") == "debug", "sets log level to debug")

func main() {
zerolog.TimeFieldFormat = ""
zerolog.SetGlobalLevel(zerolog.InfoLevel)

flag.Parse()

// Default logging level is info unless debug flag is present
if *debug {
zerolog.SetGlobalLevel(zerolog.DebugLevel)
}

c := config.New(*filepath)

log.Info().Msg("Starting service...")
Expand Down

0 comments on commit 42ba4e2

Please sign in to comment.