We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent de25870 commit c0ed5aaCopy full SHA for c0ed5aa
bootstrap/init.go
@@ -49,11 +49,11 @@ func registerMiddlewares(app *fiber.App) {
49
}
50
51
func GetUser(c *fiber.Ctx) error {
52
- user, err := models.GetUser(c)
+ userID, err := models.GetUserID(c)
53
if err != nil {
54
return err
55
56
- c.Locals("user", user)
+ c.Locals("user_id", userID)
57
58
return c.Next()
59
@@ -69,15 +69,15 @@ func MyLogger(c *fiber.Ctx) error {
69
70
71
latency := time.Since(startTime).Milliseconds()
72
- user := c.Locals("user").(*models.User)
+ userID := c.Locals("userID").(int)
73
utils.Logger.Info("LOG : ",
74
zap.Int("StatusCode", c.Response().StatusCode()),
75
zap.String("Method", string(c.Method())),
76
zap.String("OriginUrl", c.OriginalURL()),
77
zap.String("RemoteIP", string(c.Get("X-Real-IP"))),
78
zap.Int("Latency", int(latency)),
79
zap.String("Error", chainErr.Error()),
80
- zap.Int("User", user.ID),
+ zap.Int("UserID", userID),
81
)
82
83
return chainErr
0 commit comments