Skip to content

Commit 785a012

Browse files
committed
Reduce database log verbosity
1 parent 12311ee commit 785a012

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cmd/icinga-kubernetes/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ func main() {
6666
return
6767
}
6868

69-
dbLog.Info("Importing schema")
70-
7169
hasSchema, err := dbHasSchema(db, d.Database)
7270
if err != nil {
7371
klog.Fatal(err)
7472
}
7573

7674
if !hasSchema {
75+
dbLog.Info("Importing schema")
76+
7777
for _, ddl := range strings.Split(k8sMysql.Schema, ";") {
7878
if ddl = strings.TrimSpace(ddl); ddl != "" {
7979
if _, err := db.Exec(ddl); err != nil {

pkg/database/database.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,10 +640,10 @@ func (db *Database) YieldAll(ctx context.Context, factoryFunc func() (interface{
640640
func (db *Database) periodicLog(ctx context.Context, query string, counter *com.Counter) periodic.Stopper {
641641
return periodic.Start(ctx, 10*time.Second, func(tick periodic.Tick) {
642642
if count := counter.Reset(); count > 0 {
643-
db.log.Info(fmt.Sprintf("Executed %s with %d rows", query, count))
643+
db.log.V(2).Info(fmt.Sprintf("Executed %s with %d rows", query, count))
644644
}
645645
}, periodic.OnStop(func(tick periodic.Tick) {
646-
db.log.Info(fmt.Sprintf("Finished executing %s with %d rows in %s", query, counter.Total(), tick.Elapsed))
646+
db.log.V(2).Info(fmt.Sprintf("Finished executing %s with %d rows in %s", query, counter.Total(), tick.Elapsed))
647647
}))
648648
}
649649

0 commit comments

Comments
 (0)