Skip to content

Commit d887f8c

Browse files
authored
(MAINT) Allow configurable paths to ignore logging. (#61)
1 parent 0c96867 commit d887f8c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/service/service.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ type Config struct {
3939
MiddlewareHandlers []MiddlewareHandler // Optional middleware handlers which will be run on every request.
4040
Metrics bool // Optional. If true add a prometheus endpoint.
4141
ErrorHandler *MiddlewareHandler // Optional. If true a handler will be added to the end of the chain.
42+
LogIgnorePaths []string // Optional. If set, these paths will not be logged by the gin logger.
4243
}
4344

4445
// Handler will hold all the callback handlers to be registered. N.B. gin will be used.
@@ -249,7 +250,7 @@ func NewService(cfg *Config) (*Service, error) {
249250
gin.SetMode(gin.ReleaseMode)
250251
router := gin.New()
251252
logger := log.CreateLogger(cfg.LogLevel)
252-
router.Use(ginlogrus.Logger(logger))
253+
router.Use(ginlogrus.Logger(logger, cfg.LogIgnorePaths...))
253254

254255
// Set CORS to the default if it's enabled and no override passed in.
255256
setupCors(router, cfg.Cors)

0 commit comments

Comments
 (0)