From 20191120d61ce84e578d7592cf8a1e84a8883234 Mon Sep 17 00:00:00 2001 From: Dwi Siswanto Date: Sat, 20 Jan 2024 18:01:37 +0700 Subject: [PATCH 1/2] fix(writer): disable `ts` key in writer to prevent multiple key being printed in same logline Signed-off-by: Dwi Siswanto --- internal/writer/writer.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/internal/writer/writer.go b/internal/writer/writer.go index 8581005..65419a4 100644 --- a/internal/writer/writer.go +++ b/internal/writer/writer.go @@ -34,8 +34,6 @@ func (w *logWriter) Write(p []byte) (n int, err error) { return 0, err } - w.Logger = w.With("ts", d["ts"]) - err = w.write(d) return From 2a7e9da9b54d60f6ac806e883bee0df29b269f5b Mon Sep 17 00:00:00 2001 From: Dwi Siswanto Date: Sat, 20 Jan 2024 18:02:17 +0700 Subject: [PATCH 2/2] feat(logger): change `log.TimestampKey` to `ts` Signed-off-by: Dwi Siswanto --- internal/logger/logger.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/logger/logger.go b/internal/logger/logger.go index 68ecdbe..b9cdee0 100644 --- a/internal/logger/logger.go +++ b/internal/logger/logger.go @@ -25,5 +25,7 @@ func New() *log.Logger { logger.SetStyles(styles) + log.TimestampKey = "ts" + return logger }