Skip to content
Snippets Groups Projects
Commit d1f35810 authored by Jano Hendriks's avatar Jano Hendriks
Browse files

Allow expanding list of tables to be ignored when logging queries

parent c60791ca
Branches
Tags v1.171.0
No related merge requests found
......@@ -31,6 +31,7 @@ var ignoredTableInserts = []string{
}
type QueryHook struct {
IgnoredTableInserts []string
Debug bool
}
......@@ -47,8 +48,9 @@ func (d QueryHook) AfterQuery(_ context.Context, event *bun.QueryEvent) {
shouldLogQuery := !strings.Contains(sqlQuery, "api_key")
// Don't log queries for certain tables
ignoredTableInsertsCombined := append(ignoredTableInserts, d.IgnoredTableInserts...)
tableName := TableNameForQuery(event)
if lo.Contains(ignoredTableInserts, tableName) {
if lo.Contains(ignoredTableInsertsCombined, tableName) {
shouldLogQuery = false
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment