feat: add an env variable that disables access log

This commit is contained in:
Dawid Wysokiński 2021-05-29 08:22:37 +02:00
parent a685171061
commit c397032778
1 changed files with 4 additions and 1 deletions

View File

@ -186,7 +186,10 @@ func setupLogger() {
func setupRouter() *gin.Engine {
router := gin.New()
router.Use(ginlogrus.Logger(logrus.WithFields(map[string]interface{}{})), gin.Recovery())
router.Use(gin.Recovery())
if !envutil.GetenvBool("DISABLE_ACCESS_LOG") {
router.Use(ginlogrus.Logger(logrus.StandardLogger()))
}
if appmode.Equals(appmode.DevelopmentMode) {
router.Use(cors.New(cors.Config{
AllowOriginFunc: func(string) bool {