Skip to content

Commit

Permalink
Log client IP address by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
iredmail committed Dec 11, 2023
1 parent 10ad0d2 commit 030a59b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions fiberzap/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type Config struct {

// Add fields what you want see.
//
// Optional. Default: {"latency", "status", "method", "url"}
// Optional. Default: {"ip", "latency", "status", "method", "url"}
Fields []string

// FieldsFunc defines a function to return custom zap fields to append to the log.
Expand Down Expand Up @@ -77,7 +77,7 @@ var logger, _ = zap.NewProduction()
var ConfigDefault = Config{
Next: nil,
Logger: logger,
Fields: []string{"latency", "status", "method", "url"},
Fields: []string{"ip", "latency", "status", "method", "url"},
FieldsFunc: nil,
Messages: []string{"Server error", "Client error", "Success"},
Levels: []zapcore.Level{zapcore.ErrorLevel, zapcore.WarnLevel, zapcore.InfoLevel},
Expand Down
4 changes: 2 additions & 2 deletions fiberzerolog/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type Config struct {

// Add fields what you want see.
//
// Optional. Default: {"latency", "status", "method", "url", "error"}
// Optional. Default: {"ip", "latency", "status", "method", "url", "error"}
Fields []string

// Custom response messages.
Expand Down Expand Up @@ -181,7 +181,7 @@ var logger = zerolog.New(os.Stderr).With().Timestamp().Logger()
var ConfigDefault = Config{
Next: nil,
Logger: &logger,
Fields: []string{FieldLatency, FieldStatus, FieldMethod, FieldURL, FieldError},
Fields: []string{FieldIP, FieldLatency, FieldStatus, FieldMethod, FieldURL, FieldError},
Messages: []string{"Server error", "Client error", "Success"},
Levels: []zerolog.Level{zerolog.ErrorLevel, zerolog.WarnLevel, zerolog.InfoLevel},
}
Expand Down

0 comments on commit 030a59b

Please sign in to comment.