From 8d6397ecaed86538b2365c63c88a1b036705678b Mon Sep 17 00:00:00 2001 From: Dwi Siswanto Date: Sat, 20 Jan 2024 19:00:45 +0700 Subject: [PATCH] fix(writer): disable `ts` key in writer (#51) * fix(writer): disable `ts` key in writer to prevent multiple key being printed in same logline Signed-off-by: Dwi Siswanto * feat(logger): change `log.TimestampKey` to `ts` Signed-off-by: Dwi Siswanto --------- Signed-off-by: Dwi Siswanto --- internal/logger/logger.go | 2 ++ internal/writer/writer.go | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) 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 } 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