Skip to content

Commit

Permalink
docs: improve documentation and testing across the codebase
Browse files Browse the repository at this point in the history
- Expand the GinzapWithConfig function comment to include detailed information about its behavior and parameters

Signed-off-by: appleboy <[email protected]>
  • Loading branch information
appleboy committed Nov 9, 2024
1 parent 74cc010 commit 5435dd0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion zap.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ func Ginzap(logger ZapLogger, timeFormat string, utc bool) gin.HandlerFunc {
return GinzapWithConfig(logger, &Config{TimeFormat: timeFormat, UTC: utc, DefaultLevel: zapcore.InfoLevel})
}

// GinzapWithConfig returns a gin.HandlerFunc using configs
// GinzapWithConfig returns a gin.HandlerFunc (middleware) that logs requests using uber-go/zap.
//
// Requests with errors are logged using zap.Error().
// Requests without errors are logged using zap.Info().
//
// It receives a Config struct and a ZapLogger.
// The Config struct allows you to configure the logging format, the time format, and the UTC time zone.
// The ZapLogger is the minimal logger interface compatible with zap.Logger.
func GinzapWithConfig(logger ZapLogger, conf *Config) gin.HandlerFunc {
skipPaths := make(map[string]bool, len(conf.SkipPaths))
for _, path := range conf.SkipPaths {
Expand Down

0 comments on commit 5435dd0

Please sign in to comment.