diff --git a/main.go b/main.go index f5f0da0..7da3704 100644 --- a/main.go +++ b/main.go @@ -25,18 +25,6 @@ func main() { log.Println("Starting API", globals.API_VERSION) log.Println("OS:", os.Getenv("OS")) - app := fiber.New(fiber.Config{ - StrictRouting: false, - DisableStartupMessage: true, - }) - - app.Use(cors.New(cors.Config{ - AllowCredentials: true, - AllowOrigins: "http://*, https://*", - AllowHeaders: "Origin, Content-Type, User-Agent, Connection, User-Agent, Accept, Authorization, Access-Control-Allow-Origin", - AllowMethods: "GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS", - })) - file, err := os.OpenFile("./api-homolog.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) if err != nil { @@ -45,8 +33,21 @@ func main() { defer file.Close() + app := fiber.New(fiber.Config{ + StrictRouting: false, + DisableStartupMessage: true, + }) + app.Use(logger.New(logger.Config{ - Output: file, + // Output: file, + Format: "[${ip}]:${port} ${status} - ${method} ${path}\n", + })) + + app.Use(cors.New(cors.Config{ + AllowCredentials: true, + AllowOrigins: "http://*, https://*", + AllowHeaders: "Origin, Content-Type, Accept, Authorization, Access-Control-Allow-Origin", + AllowMethods: "GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS", })) if err := database.ConnectDB(); err != nil {