From e1c581e031caeb764b0c643e2750529426dca790 Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 6 Dec 2023 13:37:51 +0100 Subject: [PATCH] format: fix renderer (#250) --- format/common/text.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/format/common/text.go b/format/common/text.go index d97ed682..6e009c58 100644 --- a/format/common/text.go +++ b/format/common/text.go @@ -186,7 +186,10 @@ func FormatMessageReflectCustom(msg interface{}, ext, quotes, sep, sign string, } fieldValue := vfm.FieldByName(fieldName) // todo: replace s by json mapping of protobuf - if fieldValue.IsValid() { + if renderer, ok := RenderExtras[fieldName]; ok { + fstr[i] = fmt.Sprintf("%s%s%s%s%q", quotes, s, quotes, sign, renderer(msg)) + i++ + } else if fieldValue.IsValid() { if fieldType, ok := TextFields[fieldName]; ok { switch fieldType { @@ -213,8 +216,6 @@ func FormatMessageReflectCustom(msg interface{}, ext, quotes, sep, sign string, } } - } else if renderer, ok := RenderExtras[fieldName]; ok { - fstr[i] = fmt.Sprintf("%s%s%s%s%q", quotes, s, quotes, sign, renderer(msg)) } else { // handle specific types here switch fieldValue.Kind() {