This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 7e8c4ecc4c fix(plc4go/zerolog): remove final \n on json
7e8c4ecc4c is described below

commit 7e8c4ecc4c91a0c7c179f375f3d8de8d58da49a8
Author: Sebastian Rühl <[email protected]>
AuthorDate: Fri Nov 21 10:28:52 2025 +0100

    fix(plc4go/zerolog): remove final \n on json
---
 plc4go/pkg/api/logging/ZerologInterfaceMarshal.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/plc4go/pkg/api/logging/ZerologInterfaceMarshal.go 
b/plc4go/pkg/api/logging/ZerologInterfaceMarshal.go
index 26793d1e20..923719d902 100644
--- a/plc4go/pkg/api/logging/ZerologInterfaceMarshal.go
+++ b/plc4go/pkg/api/logging/ZerologInterfaceMarshal.go
@@ -65,7 +65,12 @@ var ZerologMessageInterfaceMarshalFunc = func(v interface{}) 
([]byte, error) {
                        if err != nil {
                                return nil, errors.Wrapf(err, "error getting 
JSON string from PLCMessage")
                        }
-                       return []byte(jsonString), nil
+                       b := []byte(jsonString)
+                       if len(b) > 0 {
+                               // Remove trailing \n which is added by Encode.
+                               return b[:len(b)-1], nil
+                       }
+                       return b, nil
                case PLCMessageAsString:
                        boxWriteBuffer := utils.NewWriteBufferBoxBased(
                                utils.WithWriteBufferBoxBasedMergeSingleBoxes(),

Reply via email to