From f0bd89759cbf17bb9a383da023f6cad586dc4f7c Mon Sep 17 00:00:00 2001 From: SoXX Date: Tue, 4 Jun 2024 13:44:15 +0200 Subject: [PATCH] refactor(db): logging & tracing Signed-off-by: SoXX --- pkg/database/postgres.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/database/postgres.go b/pkg/database/postgres.go index f8773e6..cff9d4e 100644 --- a/pkg/database/postgres.go +++ b/pkg/database/postgres.go @@ -38,11 +38,15 @@ func (p postgresqlConnection) Connect(ctx context.Context, endpoint string, user return err } + log.Infof("OtterSpace: migration compleate") + p.db, err = gorm.Open(gormPostgres.Open(dsn), &gorm.Config{}) if err != nil { return err } + log.Infof("OtterSpace: postgres connection established") + return nil } @@ -159,10 +163,10 @@ func (p postgresqlConnection) migrateDatabase(connectionString string) error { return fmt.Errorf("postgres migration: %v", err) } if n != 0 { - log.Infof("postgres migration: applied %d migrations!", n) + log.Tracef("postgres migration: applied %d migrations!", n) } else { - log.Info("postgres migration: nothing to migrate") + log.Trace("postgres migration: nothing to migrate") }