diff --git a/server/go.mod b/server/go.mod index 431d82c0..0caa3497 100644 --- a/server/go.mod +++ b/server/go.mod @@ -15,6 +15,7 @@ require ( github.com/makasim/sentryhook v0.4.2 github.com/microcosm-cc/bluemonday v1.0.25 github.com/mmcdole/gofeed v1.2.1 + github.com/onrik/gorm-logrus v0.5.0 github.com/satori/go.uuid v1.2.0 github.com/sirupsen/logrus v1.9.3 github.com/soheilhy/cmux v0.1.5 diff --git a/server/go.sum b/server/go.sum index cfc63195..0e6d2f83 100644 --- a/server/go.sum +++ b/server/go.sum @@ -393,6 +393,8 @@ github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/onrik/gorm-logrus v0.5.0 h1:JKeFH+j8AIpCDtsxHgteMtQeZtJ1k+M6UlUXwfkd2+o= +github.com/onrik/gorm-logrus v0.5.0/go.mod h1:QSx05I0N2V7M7ehsThQQmQE6K1H+drVYU2NQVNko4nw= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= diff --git a/server/main.go b/server/main.go index f08f5eec..9e624b66 100644 --- a/server/main.go +++ b/server/main.go @@ -22,6 +22,7 @@ import ( "github.com/TUM-Dev/Campus-Backend/server/backend/migration" "github.com/getsentry/sentry-go" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/onrik/gorm-logrus" log "github.com/sirupsen/logrus" "github.com/soheilhy/cmux" "golang.org/x/sync/errgroup" @@ -136,7 +137,7 @@ func setupDB() *gorm.DB { conn = mysql.Open(dbHost) } - db, err := gorm.Open(conn, &gorm.Config{}) + db, err := gorm.Open(conn, &gorm.Config{Logger: gorm_logrus.New()}) if err != nil { log.WithError(err).Panic("failed to connect database") }