From ee5445777db3c9b91b3e2ceb1a7f3b424793f9f6 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Sun, 26 Aug 2018 19:03:50 +0200 Subject: [PATCH] logging format 'human': continue printing prefixed fields if some are missing --- cmd/config_job_prometheus.go | 1 - cmd/config_job_pull.go | 2 +- cmd/logging_formatters.go | 13 ++++++------- replication/mainfsm.go | 1 - 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/cmd/config_job_prometheus.go b/cmd/config_job_prometheus.go index 8e0427b..62400f2 100644 --- a/cmd/config_job_prometheus.go +++ b/cmd/config_job_prometheus.go @@ -91,4 +91,3 @@ func (j *PrometheusJob) JobStart(ctx context.Context) { } } - diff --git a/cmd/config_job_pull.go b/cmd/config_job_pull.go index 711e3d6..a77e161 100644 --- a/cmd/config_job_pull.go +++ b/cmd/config_job_pull.go @@ -26,7 +26,7 @@ type PullJob struct { Prune PrunePolicy Debug JobDebugSettings - rep *replication.Replication + rep *replication.Replication } func parsePullJob(c JobParsingContext, name string, i map[string]interface{}) (j *PullJob, err error) { diff --git a/cmd/logging_formatters.go b/cmd/logging_formatters.go index 444f3d3..49ef88b 100644 --- a/cmd/logging_formatters.go +++ b/cmd/logging_formatters.go @@ -77,13 +77,12 @@ func (f *HumanFormatter) Format(e *logger.Entry) (out []byte, err error) { prefixed := make(map[string]bool, len(prefixFields)+2) for _, field := range prefixFields { val, ok := e.Fields[field].(string) - if ok { - if !f.ignored(field) { - fmt.Fprintf(&line, "[%s]", val) - prefixed[field] = true - } - } else { - break + if !ok { + continue + } + if !f.ignored(field) { + fmt.Fprintf(&line, "[%s]", val) + prefixed[field] = true } } diff --git a/replication/mainfsm.go b/replication/mainfsm.go index d7b2462..7d9bfc5 100644 --- a/replication/mainfsm.go +++ b/replication/mainfsm.go @@ -105,7 +105,6 @@ type Receiver interface { fsrep.Receiver } - type FilteredError struct{ fs string } func NewFilteredError(fs string) *FilteredError {