Add SQL logging before statement is run

This commit is contained in:
Tobie Morgan Hitchcock 2020-11-24 01:05:37 +00:00
parent 66ee13a52d
commit cc5ba019e8

View file

@ -125,6 +125,16 @@ func (e *executor) conduct(ctx context.Context, stm sql.Statement) {
var rsp *Response
var res []interface{}
if log.IsDebug() {
log.WithPrefix(logKeySql).WithFields(map[string]interface{}{
logKeyId: e.id,
logKeyNS: e.ns,
logKeyDB: e.db,
logKeyKind: ctx.Value(ctxKeyKind),
logKeyVars: ctx.Value(ctxKeyVars),
}).Debugln("Running", stm)
}
// If we are not inside a global transaction
// then reset the error to nil so that the
// next statement is not ignored.