Giter Site home page Giter Site logo

logger's People

Contributors

dependabot[bot] avatar fenny avatar github-actions[bot] avatar psmarcin avatar s5z6 avatar ujprasad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

logger's Issues

WARNING: DATA RACE

Versions

	github.com/gofiber/fiber v1.10.1
	github.com/gofiber/logger v0.2.0

Issue

When running my program with -race, upon initialization of the logger, I get the following data race warning:

WARNING: DATA RACE
Read at 0x00c00058bc10 by goroutine 26:
  github.com/gofiber/logger.New.func2.1()
      C:/Users/Admin/go/pkg/mod/github.com/gofiber/[email protected]/main.go:112 +0x18a9
  github.com/valyala/fasttemplate.(*Template).ExecuteFunc()
      C:/Users/Admin/go/pkg/mod/github.com/valyala/[email protected]/template.go:246 +0x4c6
  github.com/gofiber/logger.New.func2()
      C:/Users/Admin/go/pkg/mod/github.com/gofiber/[email protected]/main.go:109 +0x546
  github.com/gofiber/fiber.(*App).next()
      C:/Users/Admin/go/pkg/mod/github.com/gofiber/[email protected]/router.go:86 +0x5f5
  github.com/gofiber/fiber.(*App).handler()
      C:/Users/Admin/go/pkg/mod/github.com/gofiber/[email protected]/router.go:99 +0xc7
  github.com/gofiber/fiber.(*App).handler-fm()
      C:/Users/Admin/go/pkg/mod/github.com/gofiber/[email protected]/router.go:93 +0x6b
  github.com/valyala/fasthttp.(*Server).serveConn()
      C:/Users/Admin/go/pkg/mod/github.com/valyala/[email protected]/server.go:2162 +0x18c4
  github.com/valyala/fasthttp.(*Server).serveConn-fm()
      C:/Users/Admin/go/pkg/mod/github.com/valyala/[email protected]/server.go:1953 +0x8c
  github.com/valyala/fasthttp.(*workerPool).workerFunc()
      C:/Users/Admin/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:223 +0x17b
  github.com/valyala/fasthttp.(*workerPool).getCh.func1()
      C:/Users/Admin/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:195 +0x61

Previous write at 0x00c00058bc10 by goroutine 24:
  github.com/gofiber/logger.New.func1()
      C:/Users/Admin/go/pkg/mod/github.com/gofiber/[email protected]/main.go:90 +0x11a

Goroutine 26 (running) created at:
  github.com/valyala/fasthttp.(*workerPool).getCh()
      C:/Users/Admin/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:194 +0x32a
  github.com/valyala/fasthttp.(*workerPool).Serve()
      C:/Users/Admin/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:147 +0x55
  github.com/valyala/fasthttp.(*Server).Serve()
      C:/Users/Admin/go/pkg/mod/github.com/valyala/[email protected]/server.go:1706 +0xb56
  github.com/gofiber/fiber.(*App).Listen()
      C:/Users/Admin/go/pkg/mod/github.com/gofiber/[email protected]/app.go:349 +0x760
  main.main()
      [REDACTED]/main.go:15 +0x1fb

Goroutine 24 (running) created at:
  github.com/gofiber/logger.New()
      C:/Users/Admin/go/pkg/mod/github.com/gofiber/[email protected]/main.go:88 +0x46d
  main.main()
      [REDACTED]/main.go:15 +0x1fb

This is how I use fiber and the logger:

	app := fiber.New(&fiber.Settings{
		DisableStartupMessage: true,
	})
	app.Use(logger.New())
        ...
        app.Listen(listenAddr)

how to log return?

I find out request body option. (Thank you!)

But how to log return?
I tried to string(c.Fasthttp.Response.Body()) but crash text print out.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.