mirror of
https://github.com/zrepl/zrepl.git
synced 2025-08-09 23:17:35 +02:00
cmd: configurable logrus formatters
We lost the nice context-stack [jobname][taskname][...] at the beginning of each log line when switching to logrus. Define some field names that define these contexts. Write a human-friendly formatter that presents these field names like the solution we had before logrus. Write some other formatters for logfmt and json output along the way. Limit ourselves to stdout logging for now.
This commit is contained in:
@ -73,7 +73,7 @@ func (d *Daemon) Loop(ctx context.Context) {
|
||||
for _, job := range d.conf.Jobs {
|
||||
log.Printf("starting job %s", job.JobName())
|
||||
|
||||
logger := log.WithField("job", job.JobName())
|
||||
logger := log.WithField(logJobField, job.JobName())
|
||||
i++
|
||||
jobCtx := context.WithValue(ctx, contextKeyLog, logger)
|
||||
go func(j Job) {
|
||||
|
Reference in New Issue
Block a user