summaryrefslogtreecommitdiff
path: root/vendor/github.com/jackc/pgx/v4/rows.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/jackc/pgx/v4/rows.go')
-rw-r--r--vendor/github.com/jackc/pgx/v4/rows.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/vendor/github.com/jackc/pgx/v4/rows.go b/vendor/github.com/jackc/pgx/v4/rows.go
index 271c6e527..4749ead99 100644
--- a/vendor/github.com/jackc/pgx/v4/rows.go
+++ b/vendor/github.com/jackc/pgx/v4/rows.go
@@ -143,14 +143,15 @@ func (rows *connRows) Close() {
}
if rows.logger != nil {
+ endTime := time.Now()
+
if rows.err == nil {
if rows.logger.shouldLog(LogLevelInfo) {
- endTime := time.Now()
rows.logger.log(rows.ctx, LogLevelInfo, "Query", map[string]interface{}{"sql": rows.sql, "args": logQueryArgs(rows.args), "time": endTime.Sub(rows.startTime), "rowCount": rows.rowCount})
}
} else {
if rows.logger.shouldLog(LogLevelError) {
- rows.logger.log(rows.ctx, LogLevelError, "Query", map[string]interface{}{"err": rows.err, "sql": rows.sql, "args": logQueryArgs(rows.args)})
+ rows.logger.log(rows.ctx, LogLevelError, "Query", map[string]interface{}{"err": rows.err, "sql": rows.sql, "time": endTime.Sub(rows.startTime), "args": logQueryArgs(rows.args)})
}
if rows.err != nil && rows.conn.stmtcache != nil {
rows.conn.stmtcache.StatementErrored(rows.sql, rows.err)