Skip to content

Commit

Permalink
fix: delete log
Browse files Browse the repository at this point in the history
  • Loading branch information
Linn3a committed Oct 15, 2023
1 parent 01621ba commit 6bb80bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 1 addition & 6 deletions internal/handler/division.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package handler

import (
"fmt"
"github.com/gofiber/fiber/v2"
"github.com/opentreehole/backend/internal/repository"
"github.com/opentreehole/backend/internal/schema"
Expand Down Expand Up @@ -95,13 +94,11 @@ func (h *divisionHandler) CreateDivision(c *fiber.Ctx) (err error) {

c.Context().SetUserValue("FiberCtx", c)
user, err := h.account.GetCurrentUser(c.Context())
h.logger.Info(fmt.Sprintf("user: %+v", user))

if err != nil {
h.logger.Info(fmt.Sprintf("err: %v", err))
return err
}
if !user.IsAdmin {
h.logger.Info(fmt.Sprintf("user: %+v", user))
return c.JSON(schema.Forbidden())
}

Expand Down Expand Up @@ -146,8 +143,6 @@ func (h *divisionHandler) ModifyDivision(c *fiber.Ctx) (err error) {
return c.JSON(schema.Forbidden())
}

h.logger.Info(fmt.Sprintf("user_id: %d", user.ID))

response, err := h.service.ModifyDivision(c.Context(), id, &body)
if err != nil {
return err
Expand Down
6 changes: 3 additions & 3 deletions internal/server/middlewares.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (

"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/rs/zerolog/log"

fiberrecover "github.com/gofiber/fiber/v2/middleware/recover"
"github.com/opentreehole/backend/internal/config"
"github.com/opentreehole/backend/internal/schema"
"github.com/opentreehole/backend/pkg/utils"
"github.com/rs/zerolog/log"
)

func GetUserID(c *fiber.Ctx) (int, error) {
Expand Down Expand Up @@ -94,7 +94,7 @@ func StackTraceHandler(_ *fiber.Ctx, e any) {

func RegisterMiddlewares(conf *config.AtomicAllConfig) func(app *fiber.App) {
return func(app *fiber.App) {
//app.Use(fiberrecover.New(fiberrecover.Config{EnableStackTrace: true, StackTraceHandler: StackTraceHandler}))
app.Use(fiberrecover.New(fiberrecover.Config{EnableStackTrace: true, StackTraceHandler: StackTraceHandler}))
app.Use(MiddlewareGetUserID)
if conf.Load().Mode != "bench" {
app.Use(MiddlewareCustomLogger)
Expand Down

0 comments on commit 6bb80bd

Please sign in to comment.