gofiber / logger Goto Github PK
View Code? Open in Web Editor NEW⚠ Deprecated, available within Fiber v2
Home Page: https://github.com/gofiber/fiber/tree/master/middleware/logger
License: MIT License
⚠ Deprecated, available within Fiber v2
Home Page: https://github.com/gofiber/fiber/tree/master/middleware/logger
License: MIT License
github.com/gofiber/fiber v1.10.1
github.com/gofiber/logger v0.2.0
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)
Hi, any chance to include error in logs? Like the one implemented here? https://github.com/labstack/echo/blob/master/middleware/logger.go
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.