diff --git a/consts.go b/consts.go index be0a40e..5b9b19d 100644 --- a/consts.go +++ b/consts.go @@ -1,15 +1,5 @@ package main -import formatter "github.com/antonfisher/nested-logrus-formatter" - const ( defaultConfigFilePath = "gron.conf" ) - -var ( - logFormat = &formatter.Formatter{ - TimestampFormat: config.TimeFormat, - HideKeys: true, - NoColors: true, - TrimMessages: true} -) diff --git a/job.go b/job.go index 6187454..c8de416 100644 --- a/job.go +++ b/job.go @@ -80,7 +80,7 @@ func (j *Job) Run() { l := log.New() l.SetOutput(jobLogFile) - l.SetFormatter(logFormat) + l.SetFormatter(log.StandardLogger().Formatter) log.WithField("job", j.FileName).Info("started") l.Info("started") diff --git a/main.go b/main.go index e116c19..c5b9896 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "path/filepath" "syscall" + formatter "github.com/antonfisher/nested-logrus-formatter" "github.com/robfig/cron/v3" log "github.com/sirupsen/logrus" ) @@ -28,7 +29,11 @@ func init() { log.Fatalln(err) } - log.SetFormatter(logFormat) + log.SetFormatter(&formatter.Formatter{ + TimestampFormat: config.TimeFormat, + HideKeys: true, + NoColors: true, + TrimMessages: true}) //multiWriter := io.MultiWriter(os.Stderr, logFile) //log.SetOutput(multiWriter) log.SetOutput(logFile)