From 5640938e41d4616536b6dbcf18db9c1ef845ce42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Franc=C3=A9=20Wilke?= <francewilke@gmail.com>
Date: Fri, 16 Feb 2024 15:02:47 +0200
Subject: [PATCH] SanitiseFields - Also cater for non-strings in pointer
 objects

---
 logs/logs.go | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/logs/logs.go b/logs/logs.go
index 4f562c4..569a830 100644
--- a/logs/logs.go
+++ b/logs/logs.go
@@ -31,7 +31,7 @@ const (
 )
 
 type LogEntryWithLevel struct {
-	//LogBuffer *bytes.Buffer
+	// LogBuffer *bytes.Buffer
 	LogEntry *log.Entry
 	Message  interface{}
 	LogLevel log.Level
@@ -88,11 +88,14 @@ func SanitiseFields(fields map[string]interface{}) map[string]interface{} {
 			if pointerValue.Kind() == reflect.String {
 				sanitisedString := SanitiseLogs(pointerValue.String())
 				sanitisedFields[key] = &sanitisedString
+			} else {
+				// Don't sanitise fields that are not strings
+				sanitisedFields[key] = field
 			}
 		} else if value.Kind() == reflect.String {
 			sanitisedFields[key] = SanitiseLogs(value.String())
 		} else {
-			// Don't sanitise fields that
+			// Don't sanitise fields that are not strings
 			sanitisedFields[key] = field
 		}
 	}
-- 
GitLab