Added custom logger. Right now, not configurable.

This commit is contained in:
Musab Gültekin
2021-04-13 23:36:42 +03:00
parent 129402d754
commit e3d79e2574
10 changed files with 39 additions and 32 deletions

View File

@ -2,7 +2,7 @@ package middleware
import (
"github.com/geziyor/geziyor/client"
"log"
"github.com/geziyor/geziyor/internal"
"sync"
)
@ -18,7 +18,7 @@ func (a *DuplicateRequests) ProcessRequest(r *client.Request) {
requestURL := r.Request.URL.String()
if _, visited := a.visitedURLs.LoadOrStore(requestURL, struct{}{}); visited {
if _, logged := a.logOnlyOnce.LoadOrStore(requestURL, struct{}{}); !logged {
log.Printf("URL already visited %s\n", requestURL)
internal.Logger.Printf("URL already visited %s\n", requestURL)
}
r.Cancel()
}