Use logrus for logging

This commit is contained in:
eikendev 2022-04-11 23:46:02 +02:00
parent c96baf40a5
commit f839f248b9
No known key found for this signature in database
GPG key ID: A1BDB1B28C8EF694
19 changed files with 192 additions and 87 deletions

View file

@ -1,21 +1,20 @@
package router
import (
"log"
"github.com/gin-contrib/location"
"github.com/gin-gonic/gin"
"github.com/pushbits/server/internal/api"
"github.com/pushbits/server/internal/authentication"
"github.com/pushbits/server/internal/authentication/credentials"
"github.com/pushbits/server/internal/database"
"github.com/pushbits/server/internal/dispatcher"
"github.com/gin-contrib/location"
"github.com/gin-gonic/gin"
"github.com/pushbits/server/internal/log"
)
// Create a Gin engine and setup all routes.
func Create(debug bool, cm *credentials.Manager, db *database.Database, dp *dispatcher.Dispatcher) *gin.Engine {
log.Println("Setting up HTTP routes.")
log.L.Println("Setting up HTTP routes.")
if !debug {
gin.SetMode(gin.ReleaseMode)
@ -28,7 +27,8 @@ func Create(debug bool, cm *credentials.Manager, db *database.Database, dp *disp
notificationHandler := api.NotificationHandler{DB: db, DP: dp}
userHandler := api.UserHandler{AH: &applicationHandler, CM: cm, DB: db, DP: dp}
r := gin.Default()
r := gin.New()
r.Use(log.GinLogger(log.L), gin.Recovery())
r.Use(location.Default())