过滤空的字段

This commit is contained in:
2023-08-26 12:49:06 +08:00
parent 532ea798c3
commit 43ebfc11aa
3 changed files with 8 additions and 74 deletions

View File

@ -167,6 +167,9 @@ func (g *Gorm) write(dataList []zap.Field, level string) {
}
if nil != g.ctx {
for _, extraField := range g.extraCtxFieldList {
if len(extraField) == 0 {
continue
}
dataList = append(dataList, zap.Any(extraField, g.ctx.Value(extraField)))
}
}