[feature] Add log-db-queries config option (#465)

This commit is contained in:
tobi 2022-04-18 16:47:11 +02:00 committed by GitHub
commit 094f032f74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 43 additions and 15 deletions

View file

@ -136,9 +136,9 @@ func NewBunDBService(ctx context.Context) (db.DB, error) {
return nil, fmt.Errorf("database type %s not supported for bundb", dbType)
}
// add a hook to just log queries and the time they take
// add a hook to log queries and the time they take
// only do this for logging where performance isn't 1st concern
if logrus.GetLevel() >= logrus.DebugLevel {
if logrus.GetLevel() >= logrus.DebugLevel && viper.GetBool(config.Keys.LogDbQueries) {
conn.DB.AddQueryHook(newDebugQueryHook())
}