refactor(db): logging & tracing

Signed-off-by: SoXX <soxx@fenpa.ws>
This commit is contained in:
SoXX 2024-06-04 13:44:15 +02:00
parent ebd25580fe
commit f0bd89759c

View File

@ -38,11 +38,15 @@ func (p postgresqlConnection) Connect(ctx context.Context, endpoint string, user
return err return err
} }
log.Infof("OtterSpace: migration compleate")
p.db, err = gorm.Open(gormPostgres.Open(dsn), &gorm.Config{}) p.db, err = gorm.Open(gormPostgres.Open(dsn), &gorm.Config{})
if err != nil { if err != nil {
return err return err
} }
log.Infof("OtterSpace: postgres connection established")
return nil return nil
} }
@ -159,10 +163,10 @@ func (p postgresqlConnection) migrateDatabase(connectionString string) error {
return fmt.Errorf("postgres migration: %v", err) return fmt.Errorf("postgres migration: %v", err)
} }
if n != 0 { if n != 0 {
log.Infof("postgres migration: applied %d migrations!", n) log.Tracef("postgres migration: applied %d migrations!", n)
} else { } else {
log.Info("postgres migration: nothing to migrate") log.Trace("postgres migration: nothing to migrate")
} }