From 785a0121c113e332c9bd866cb3d138f832af7698 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 13 Mar 2024 17:08:51 +0100 Subject: [PATCH] Reduce database log verbosity --- cmd/icinga-kubernetes/main.go | 4 ++-- pkg/database/database.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/icinga-kubernetes/main.go b/cmd/icinga-kubernetes/main.go index 09b639cd..33efe113 100644 --- a/cmd/icinga-kubernetes/main.go +++ b/cmd/icinga-kubernetes/main.go @@ -66,14 +66,14 @@ func main() { return } - dbLog.Info("Importing schema") - hasSchema, err := dbHasSchema(db, d.Database) if err != nil { klog.Fatal(err) } if !hasSchema { + dbLog.Info("Importing schema") + for _, ddl := range strings.Split(k8sMysql.Schema, ";") { if ddl = strings.TrimSpace(ddl); ddl != "" { if _, err := db.Exec(ddl); err != nil { diff --git a/pkg/database/database.go b/pkg/database/database.go index 0b2ce5cd..01a91318 100644 --- a/pkg/database/database.go +++ b/pkg/database/database.go @@ -640,10 +640,10 @@ func (db *Database) YieldAll(ctx context.Context, factoryFunc func() (interface{ func (db *Database) periodicLog(ctx context.Context, query string, counter *com.Counter) periodic.Stopper { return periodic.Start(ctx, 10*time.Second, func(tick periodic.Tick) { if count := counter.Reset(); count > 0 { - db.log.Info(fmt.Sprintf("Executed %s with %d rows", query, count)) + db.log.V(2).Info(fmt.Sprintf("Executed %s with %d rows", query, count)) } }, periodic.OnStop(func(tick periodic.Tick) { - db.log.Info(fmt.Sprintf("Finished executing %s with %d rows in %s", query, counter.Total(), tick.Elapsed)) + db.log.V(2).Info(fmt.Sprintf("Finished executing %s with %d rows in %s", query, counter.Total(), tick.Elapsed)) })) }