From df6c3c9237fe079c0c5b65b914ba69521e63ec70 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Fri, 10 Feb 2017 16:49:28 +0800 Subject: [PATCH] Refactor format log for postgres --- logger.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/logger.go b/logger.go index 9f1d4458..2d07df5c 100644 --- a/logger.go +++ b/logger.go @@ -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)