Merge pull request #4 from Vivino/logs

Logging tweaking
This commit is contained in:
Raul-Mircea Crivineanu 2020-01-23 14:33:27 +01:00 committed by GitHub
commit f38071944f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,6 @@ package gorm
import ( import (
"strings" "strings"
"time"
) )
// TableAndQuery returns the table name and the query already formatted as a string // TableAndQuery returns the table name and the query already formatted as a string
@ -10,8 +9,9 @@ func (scope *Scope) TableAndQuery() (string, string) {
scope.InstanceSet("skip_bindvar", true) scope.InstanceSet("skip_bindvar", true)
scope.prepareQuerySQL() scope.prepareQuerySQL()
qs := LogFormatter("sql", "q", time.Duration(1), scope.SQL, scope.SQLVars, int64(1)) //qs := LogFormatter("sql", "q", time.Duration(1), scope.SQL, scope.SQLVars, int64(1))
t, q := scope.TableName(), qs[3].(string) //t, q := scope.TableName(), qs[3].(string)
t, q := scope.TableName(), scope.SQL
if t == "" { if t == "" {
qsplit := strings.Fields(strings.ToLower(q)) qsplit := strings.Fields(strings.ToLower(q))
for i := range qsplit { for i := range qsplit {