backport
Some checks are pending
build / test (push) Waiting to run
build / lint (push) Waiting to run
codeql / analyze (go) (push) Waiting to run

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-02-21 15:08:58 +03:00
parent 23f0ad0f2f
commit 0a395235d6
11 changed files with 490 additions and 60 deletions

View File

@@ -30,11 +30,11 @@ func (l *mlogger) Log(lvl kgo.LogLevel, msg string, args ...interface{}) {
return
}
if len(args) > 0 {
fields := make([]interface{}, 0, len(args))
fields := make(map[string]interface{}, int(len(args)/2))
for i := 0; i <= len(args)/2; i += 2 {
fields = append(fields, fmt.Sprintf("%v", args[i]), args[i+1])
fields[fmt.Sprintf("%v", args[i])] = args[i+1]
}
l.l.Fields(fields...).Log(l.ctx, mlvl, msg)
l.l.Fields(fields).Log(l.ctx, mlvl, msg)
} else {
l.l.Log(l.ctx, mlvl, msg)
}