You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In callbacks.go you can find the processor.Execute implementation.
Within it, this code:
if stmt.SQL.Len() > 0 {
db.Logger.Trace(stmt.Context, curTime, func() (string, int64) {
sql, vars := stmt.SQL.String(), stmt.Vars
if filter, ok := db.Logger.(ParamsFilter); ok {
sql, vars = filter.ParamsFilter(stmt.Context, stmt.SQL.String(), stmt.Vars...)
}
return db.Dialector.Explain(sql, vars...), db.RowsAffected
}, db.Error)
}
This code allows a custom Logger to implement the ParamsFilter interface, and thus be able to use this strong ability.
In finisher-api.go, the db.Create/Update/Delete/etc.. all use the custom Logger as is when calling Execute.
However, db.Scan uses a different logic, and right before calling the underlying logic, it does:
This runs over the custom Logger implementation, and uses the default traceRecorder, which does not implement ParamsFilter, nor allows to be extended with such logic.
Motivation
Allow db.Scan to leverage the ParamsFilter interface. With that, PII logging can be avoided.
Describe the feature
In callbacks.go you can find the processor.Execute implementation.
Within it, this code:
This code allows a custom Logger to implement the ParamsFilter interface, and thus be able to use this strong ability.
In finisher-api.go, the db.Create/Update/Delete/etc.. all use the custom Logger as is when calling Execute.
However, db.Scan uses a different logic, and right before calling the underlying logic, it does:
This runs over the custom Logger implementation, and uses the default traceRecorder, which does not implement ParamsFilter, nor allows to be extended with such logic.
Motivation
Allow db.Scan to leverage the ParamsFilter interface. With that, PII logging can be avoided.
Related Issues
The text was updated successfully, but these errors were encountered: