Skip to content

Commit

Permalink
Add docs from gofiber/contrib@9d3d3b7
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 8, 2025
1 parent 0437483 commit 717a39f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/contrib/fiberzap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import (
func main() {
app := fiber.New()
logger, _ := zap.NewProduction()
defer logger.Sync()

app.Use(fiberzap.New(fiberzap.Config{
Logger: logger,
Expand Down Expand Up @@ -103,9 +104,12 @@ import (

func main() {
app := fiber.New()
log.SetLogger(fiberzap.NewLogger(fiberzap.LoggerConfig{
logger := fiberzap.NewLogger(fiberzap.LoggerConfig{
ExtraKeys: []string{"request_id"},
}))
})
log.SetLogger(logger)
defer logger.Sync()

app.Use(func(c *fiber.Ctx) error {
ctx := context.WithValue(c.UserContext(), "request_id", "123")
c.SetUserContext(ctx)
Expand Down

0 comments on commit 717a39f

Please sign in to comment.