remove timestamp from logging if started via systemd
This commit is contained in:
parent
220ce63d95
commit
3966020cfe
1 changed files with 6 additions and 2 deletions
|
@ -16,8 +16,12 @@ import (
|
|||
var FlagDebug bool
|
||||
|
||||
func InitializeLogger() {
|
||||
|
||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339})
|
||||
if os.Getenv("INVOCATION_ID") == "" {
|
||||
// detect systemd
|
||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339})
|
||||
} else {
|
||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stdout, NoColor: true, PartsExclude: []string{"time"}})
|
||||
}
|
||||
|
||||
if FlagDebug {
|
||||
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
||||
|
|
Loading…
Reference in a new issue