fix(observabillity): include otel logs
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 5m33s
Build and Push Docker Image / Build-And-Push-Docker-Image (push) Successful in 5m4s

This commit was merged in pull request #158.
This commit is contained in:
2025-06-07 15:12:18 +02:00
parent e65146c71c
commit 63ade5916e
26 changed files with 231 additions and 185 deletions

View File

@@ -1,10 +1,9 @@
package db
import (
"spend-sparrow/internal/log"
"spend-sparrow/internal/types"
"errors"
"log/slog"
"spend-sparrow/internal/types"
"github.com/golang-migrate/migrate/v4"
"github.com/golang-migrate/migrate/v4/database/sqlite3"
@@ -15,7 +14,7 @@ import (
type migrationLogger struct{}
func (l migrationLogger) Printf(format string, v ...any) {
log.L.Info(format, v...)
slog.Info(format, v...)
}
func (l migrationLogger) Verbose() bool {
return false
@@ -24,7 +23,7 @@ func (l migrationLogger) Verbose() bool {
func RunMigrations(db *sqlx.DB, pathPrefix string) error {
driver, err := sqlite3.WithInstance(db.DB, &sqlite3.Config{})
if err != nil {
log.L.Error("Could not create Migration instance", "err", err)
slog.Error("Could not create Migration instance", "err", err)
return types.ErrInternal
}
@@ -33,14 +32,14 @@ func RunMigrations(db *sqlx.DB, pathPrefix string) error {
"",
driver)
if err != nil {
log.L.Error("Could not create migrations instance", "err", err)
slog.Error("Could not create migrations instance", "err", err)
return types.ErrInternal
}
m.Log = migrationLogger{}
if err = m.Up(); err != nil && !errors.Is(err, migrate.ErrNoChange) {
log.L.Error("Could not run migrations", "err", err)
slog.Error("Could not run migrations", "err", err)
return types.ErrInternal
}