Merge pull request #9

feat: add an option to disable the access log
This commit is contained in:
Dawid Wysokiński 2021-05-29 08:24:13 +02:00 committed by GitHub
commit 5e7c9d2ebe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 {