From 1a79c1958340162d62d4cfc8fe2bbda2c3144ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 18 Jul 2023 16:12:26 +0200 Subject: [PATCH] Manager: improve logging of database consistency checks The log messages now all start with `database: `. No functional changes. --- internal/manager/persistence/integrity.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/manager/persistence/integrity.go b/internal/manager/persistence/integrity.go index 2686e7fb..b79e84d5 100644 --- a/internal/manager/persistence/integrity.go +++ b/internal/manager/persistence/integrity.go @@ -74,26 +74,26 @@ func (db *DB) pragmaIntegrityCheck(ctx context.Context) (ok bool) { Raw("PRAGMA integrity_check"). Scan(&issues) if tx.Error != nil { - log.Error().Err(tx.Error).Msg("database error checking integrity") + log.Error().Err(tx.Error).Msg("database: error checking integrity") return false } switch len(issues) { case 0: - log.Warn().Msg("database integrity check returned nothing, expected explicit 'ok'; treating as an implicit 'ok'") + log.Warn().Msg("database: integrity check returned nothing, expected explicit 'ok'; treating as an implicit 'ok'") return true case 1: if issues[0].Description == "ok" { - log.Debug().Msg("database integrity check ok") + log.Debug().Msg("database: integrity check ok") return true } } - log.Error().Int("num_issues", len(issues)).Msg("database integrity check failed") + log.Error().Int("num_issues", len(issues)).Msg("database: integrity check failed") for _, issue := range issues { log.Error(). Str("description", issue.Description). - Msg("database integrity check failure") + Msg("database: integrity check failure") } return false @@ -115,23 +115,23 @@ func (db *DB) pragmaForeignKeyCheck(ctx context.Context) (ok bool) { Raw("PRAGMA foreign_key_check"). Scan(&issues) if tx.Error != nil { - log.Error().Err(tx.Error).Msg("database error checking foreign keys") + log.Error().Err(tx.Error).Msg("database: error checking foreign keys") return false } if len(issues) == 0 { - log.Debug().Msg("database foreign key check ok") + log.Debug().Msg("database: foreign key check ok") return true } - log.Error().Int("num_issues", len(issues)).Msg("database foreign key check failed") + log.Error().Int("num_issues", len(issues)).Msg("database: foreign key check failed") for _, issue := range issues { log.Error(). Str("table", issue.Table). Int("rowid", issue.RowID). Str("parent", issue.Parent). Int("fkid", issue.FKID). - Msg("database foreign key relation missing") + Msg("database: foreign key relation missing") } return false