From 22afab0d0727aedfc90204ecf3ead5d2481e3550 Mon Sep 17 00:00:00 2001 From: OpenIM-Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Thu, 1 Aug 2024 11:59:27 +0800 Subject: [PATCH] fix: log kv do not print origin pointer. (#120) * optimization: slice sub. * fix: rpc logger add more detail info. * feat: add msg gateway error. * refactor: separate functions with error containing message and error with only stack trace. * feat: add stdout and stderr info. * feat: add strings and sql log. * feat: add copy function. * feat: add strings function. * feat: add strings function. * feat: add strings function. * feat: print version filed. * fix: version update. * refactor: change go mod name. * refactor: change go mod name. * refactor: change go mod name. * refactor: log change. * refactor: log change. * refactor: log change. * fix: log kv do not print origin pointer. --- log/zap.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/log/zap.go b/log/zap.go index caf4dda3..21bb541f 100644 --- a/log/zap.go +++ b/log/zap.go @@ -24,10 +24,11 @@ import ( rotatelogs "github.com/openimsdk/tools/log/file-rotatelogs" "github.com/openimsdk/tools/utils/stringutil" - "github.com/openimsdk/protocol/constant" - "github.com/openimsdk/tools/mcontext" "go.uber.org/zap" "go.uber.org/zap/zapcore" + + "github.com/openimsdk/protocol/constant" + "github.com/openimsdk/tools/mcontext" ) type LogFormatter interface { @@ -393,8 +394,6 @@ func (l *ZapLogger) kvAppend(ctx context.Context, keysAndValues []any) []any { for i := 1; i < len(keysAndValues); i += 2 { if s, ok := keysAndValues[i].(interface{ String() string }); ok { keysAndValues[i] = s.String() - } else { - keysAndValues[i] = fmt.Sprintf("%+v", keysAndValues[i]) } }