logging format 'human': continue printing prefixed fields if some are missing
This commit is contained in:
@@ -91,4 +91,3 @@ func (j *PrometheusJob) JobStart(ctx context.Context) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user