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
This commit is contained in:
aixiaoxiang 2019-02-10 15:37:39 +08:00 committed by Jinzhu
parent 9f1a7f5351
commit 8494ecdc98
1 changed files with 7 additions and 1 deletions

View File

@ -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")