Skip to content

Commit f6a63bb

Browse files
authored
Merge pull request #22 from TimeLooper/master
修复日志输出报错
2 parents 4a8e674 + d69f34a commit f6a63bb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/loggers/facade/zaplog.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,16 @@ func (zlog ZapLog) Info(ctx context.Context, msg string, info map[string]string)
4343
}
4444

4545
func (zlog ZapLog) Error(ctx context.Context, msg string, info map[string]string) {
46-
zapSlice := make([]zap.Field, len(info))
46+
4747
var fieldNum int
4848

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

54+
zapSlice := make([]zap.Field, len(info))
55+
5456
for k, v := range info {
5557
zapSlice[fieldNum] = zap.String(k, v)
5658
fieldNum++

0 commit comments

Comments
 (0)