From cadb2db8c7d538ba01e0e5b636324705b0a7fd17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Sun, 11 Jun 2023 17:50:40 +0800 Subject: [PATCH] =?UTF-8?q?enhance(log):=E6=94=B9=E8=BF=9B=E5=AF=B9?= =?UTF-8?q?=E4=BA=8E=E7=A9=BA=E7=99=BD=E6=8C=87=E9=92=88=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E7=9A=84=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logger/logger.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/logger/logger.go b/logger/logger.go index ddf414d..5ab4c6e 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -139,7 +139,7 @@ func DecimalField(key string, val decimal.Decimal) zap.Field { func DecimalFieldp(key string, val *decimal.Decimal) zap.Field { if val == nil { - return zap.String(key, "null") + return zap.Stringp(key, nil) } return DecimalField(key, *val) } @@ -148,17 +148,17 @@ func NullDecimalField(key string, val decimal.NullDecimal) zap.Field { if val.Valid { return DecimalField(key, val.Decimal) } - return zap.String(key, "null") + return zap.Stringp(key, nil) } func NullDecimalFieldp(key string, val *decimal.NullDecimal) zap.Field { if val == nil { - return zap.String(key, "null") + return zap.Stringp(key, nil) } if val.Valid { return DecimalField(key, val.Decimal) } - return zap.String(key, "null") + return zap.Stringp(key, nil) } func DateField(key string, val types.Date) zap.Field { @@ -167,7 +167,7 @@ func DateField(key string, val types.Date) zap.Field { func DateFieldp(key string, val *types.Date) zap.Field { if val == nil { - return zap.String(key, "null") + return zap.Stringp(key, nil) } return DateField(key, *val) } @@ -178,7 +178,7 @@ func DateTimeField(key string, val types.DateTime) zap.Field { func DateTimeFieldp(key string, val *types.DateTime) zap.Field { if val == nil { - return zap.String(key, "null") + return zap.Stringp(key, nil) } return DateTimeField(key, *val) }