Skip to content

Commit

Permalink
Merge pull request #22 from TimeLooper/master
Browse files Browse the repository at this point in the history
修复日志输出报错
  • Loading branch information
gphper authored Oct 11, 2024
2 parents 4a8e674 + d69f34a commit f6a63bb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/loggers/facade/zaplog.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ func (zlog ZapLog) Info(ctx context.Context, msg string, info map[string]string)
}

func (zlog ZapLog) Error(ctx context.Context, msg string, info map[string]string) {
zapSlice := make([]zap.Field, len(info))

var fieldNum int

value := ctx.Value("requestId")
if value != nil {
info["request_id"] = value.(string)
}

zapSlice := make([]zap.Field, len(info))

for k, v := range info {
zapSlice[fieldNum] = zap.String(k, v)
fieldNum++
Expand Down

0 comments on commit f6a63bb

Please sign in to comment.