Improve client logging.
Some checks failed
Linting and tests / Linting (push) Failing after 4s
Linting and tests / Tests (push) Failing after 3s

This commit is contained in:
2025-09-10 20:04:19 +05:00
parent e3b9c9ae40
commit c2142cc1a6
15 changed files with 118 additions and 44 deletions

View File

@@ -9,6 +9,7 @@ import (
"strings"
"bunker/client/internal/services/core"
"bunker/commons"
"github.com/pressly/goose/v3"
)
@@ -16,7 +17,7 @@ import (
var errMigrationsAlreadyRegistered = errors.New("migrations already registered")
func (d *database) applyMigrations() error {
slog.Info("Migrating database...")
d.logger.Info("Migrating database...")
modules := make([]string, 0)
@@ -28,8 +29,11 @@ func (d *database) applyMigrations() error {
_ = goose.SetDialect(string(goose.DialectSQLite3))
gooseLogger := commons.NewGooseLogger(d.logger)
goose.SetLogger(gooseLogger)
for _, module := range modules {
slog.Info("Migrating database for module...", "module", module)
d.logger.Info("Migrating database for module...", "module", module)
goose.SetBaseFS(d.migrations[module])
goose.SetTableName(strings.ReplaceAll(module, "/", "_") + "_migrations")
@@ -45,7 +49,7 @@ func (d *database) applyMigrations() error {
d.version += moduleDBVersion
slog.Info(
d.logger.Info(
"Database for module migrated to latest version",
"module", module,
"module_db_version", moduleDBVersion,
@@ -53,7 +57,7 @@ func (d *database) applyMigrations() error {
)
}
slog.Info("Database migrated.", "version", d.version)
d.logger.Info("Database migrated.", "version", d.version)
return nil
}