Skip to content

Commit

Permalink
append fields instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamess-Lucass committed Sep 4, 2023
1 parent 82b9cbd commit d1a0c5b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fiberzap/zap.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,14 @@ func New(config ...Config) fiber.Handler {

// Add fields
fields := make([]zap.Field, 0, len(cfg.Fields)+1)
fields = append(fields, zap.Error(err))

if cfg.FieldsFunc != nil {
fields = cfg.FieldsFunc(c)
for _, field := range cfg.FieldsFunc(c) {
fields = append(fields, field)
}
}

fields = append(fields, zap.Error(err))

for _, field := range cfg.Fields {
switch field {
case "referer":
Expand Down

0 comments on commit d1a0c5b

Please sign in to comment.