Refactor format log for postgres

This commit is contained in:
Jinzhu 2017-02-10 16:49:28 +08:00
parent c730b30a78
commit df6c3c9237
1 changed files with 2 additions and 2 deletions

View File

@ -73,8 +73,8 @@ var LogFormatter = func(values ...interface{}) (messages []interface{}) {
if numericPlaceHolderRegexp.MatchString(values[3].(string)) {
sql = values[3].(string)
for index, value := range formattedValues {
placeholder := fmt.Sprintf(`\$%d`, index+1)
sql = regexp.MustCompile(placeholder).ReplaceAllString(sql, value)
placeholder := fmt.Sprintf(`\$%d([^\d])`, index+1)
sql = regexp.MustCompile(placeholder).ReplaceAllString(sql, value+"$1")
}
} else {
formattedValuesLength := len(formattedValues)