From 5c6023f302f93e8f81cd918388171bcfbb59c3e1 Mon Sep 17 00:00:00 2001 From: "jia.yu" <2024588807@qq.com> Date: Thu, 4 Jul 2024 17:30:17 +0800 Subject: [PATCH] fix: correct field filtering logic in writeFields --- console.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/console.go b/console.go index 7e65e86f..e573916f 100644 --- a/console.go +++ b/console.go @@ -190,10 +190,16 @@ func (w ConsoleWriter) writeFields(evt map[string]interface{}, buf *bytes.Buffer continue } - switch field { - case LevelFieldName, TimestampFieldName, MessageFieldName, CallerFieldName: + for _, excluded := range w.PartsOrder { + if field == excluded { + isExcluded = true + break + } + } + if isExcluded { continue } + fields = append(fields, field) }