Implement gin request logger with param filtering

This commit is contained in:
Dan Sosedoff
2022-12-01 12:35:02 -06:00
parent 1eb86060b5
commit c996d71378
4 changed files with 63 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/jessevdk/go-flags"
"github.com/sirupsen/logrus"
"github.com/sosedoff/pgweb/pkg/api"
"github.com/sosedoff/pgweb/pkg/bookmarks"
@@ -183,7 +184,10 @@ func printVersion() {
}
func startServer() {
router := gin.Default()
router := gin.New()
router.Use(api.RequestLogger(logrus.New()))
router.Use(gin.Recovery())
// Enable HTTP basic authentication only if both user and password are set
if options.AuthUser != "" && options.AuthPass != "" {