fix: switch to fmt.Printf

This commit is contained in:
Lewis Crichton
2023-08-10 22:37:57 +01:00
parent a683d8296f
commit c712e07b82
+4 -3
View File
@@ -3,6 +3,7 @@ package routes
import ( import (
"crypto/rand" "crypto/rand"
"encoding/hex" "encoding/hex"
"fmt"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/imroc/req/v3" "github.com/imroc/req/v3"
@@ -44,7 +45,7 @@ func GETOAuthCallback(c *fiber.Ctx) error {
}).SetSuccessResult(&accessTokenResult).Post("https://discord.com/api/oauth2/token") }).SetSuccessResult(&accessTokenResult).Post("https://discord.com/api/oauth2/token")
if err != nil { if err != nil {
c.Context().Logger().Printf("Failed to request access token: %v", err) fmt.Printf("Failed to request access token: %v", err)
return c.Status(500).JSON(&fiber.Map{ return c.Status(500).JSON(&fiber.Map{
"error": "Failed to request access token", "error": "Failed to request access token",
}) })
@@ -65,7 +66,7 @@ func GETOAuthCallback(c *fiber.Ctx) error {
}).SetSuccessResult(&userResult).Get("https://discord.com/api/users/@me") }).SetSuccessResult(&userResult).Get("https://discord.com/api/users/@me")
if err != nil { if err != nil {
c.Context().Logger().Printf("Failed to request user: %v", err) fmt.Printf("Failed to request user: %v", err)
return c.Status(500).JSON(&fiber.Map{ return c.Status(500).JSON(&fiber.Map{
"error": "Failed to request user", "error": "Failed to request user",
}) })
@@ -92,7 +93,7 @@ func GETOAuthCallback(c *fiber.Ctx) error {
_, err := rand.Read(key) _, err := rand.Read(key)
if err != nil { if err != nil {
c.Context().Logger().Printf("Failed to generate secret: %v", err) fmt.Printf("Failed to generate secret: %v", err)
return c.Status(500).JSON(&fiber.Map{ return c.Status(500).JSON(&fiber.Map{
"error": "Failed to generate secret", "error": "Failed to generate secret",
}) })