Skip to content

Commit

Permalink
Update fiberzap docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gaby authored Jan 8, 2025
1 parent b1dec77 commit bb45e36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions 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
2 changes: 1 addition & 1 deletion fiberzap/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type Config struct {

// Add custom zap logger.
//
// Optional. Default: zap.NewProduction()\n
// Optional. Default: zap.NewProduction()
Logger *zap.Logger

// Add fields what you want see.
Expand Down

0 comments on commit bb45e36

Please sign in to comment.