From 8494ecdc9857e74477cd95965df2f0297fe6a461 Mon Sep 17 00:00:00 2001 From: aixiaoxiang Date: Sun, 10 Feb 2019 15:37:39 +0800 Subject: [PATCH] Better log output int8, int, int16, int32, int64, float32, float64, bool. (#2258) * Better log output int, int16, int32, int64, int8, float32, float64. * Better log output bool --- logger.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/logger.go b/logger.go index 4324a2e4..10a1b805 100644 --- a/logger.go +++ b/logger.go @@ -63,7 +63,13 @@ var LogFormatter = func(values ...interface{}) (messages []interface{}) { formattedValues = append(formattedValues, "NULL") } } else { - formattedValues = append(formattedValues, fmt.Sprintf("'%v'", value)) + switch value.(type) { + case int8, int, int16, int32, int64, float32, float64, bool: + formattedValues = append(formattedValues, fmt.Sprintf("%v", value)) + break + default: + formattedValues = append(formattedValues, fmt.Sprintf("'%v'", value)) + } } } else { formattedValues = append(formattedValues, "NULL")