From 5ec87be7cca1b3f6a08631e57482c1a98e80de63 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Thu, 14 Dec 2023 17:53:55 +0100 Subject: [PATCH] enable sql debug if loglevel is set to debug --- main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.go b/main.go index 0b99092..a47ffbb 100644 --- a/main.go +++ b/main.go @@ -76,6 +76,10 @@ func main() { }(db) } + if log.GetLevel() == log.DebugLevel { + db = db.Debug() + } + if err := db.Schema.Create(context.Background()); err != nil { log.Panicf("automigrate failed: %v", err) }