Skip to content

Commit f8ef968

Browse files
committed
Add ginlogger.Default
1 parent a43b235 commit f8ef968

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ginlogger/ginlogger.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,10 @@ func LoggingMiddleware(ctx *gin.Context) {
2525
}).Info("HTTP Request")
2626
ctx.Next()
2727
}
28+
29+
// Default creates a Gin router with default parameters, but using [LoggingMiddleware]
30+
func Default(opts ...gin.OptionFunc) *gin.Engine {
31+
engine := gin.New()
32+
engine.Use(LoggingMiddleware, gin.Recovery())
33+
return engine.With(opts...)
34+
}

0 commit comments

Comments
 (0)