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

@ -3,7 +3,6 @@ package middleware
import (
"github.com/geziyor/geziyor/client"
"github.com/geziyor/geziyor/internal"
"log"
"sync"
)
@ -16,7 +15,7 @@ type AllowedDomains struct {
func (a *AllowedDomains) ProcessRequest(r *client.Request) {
if len(a.AllowedDomains) != 0 && !internal.Contains(a.AllowedDomains, r.Host) {
if _, logged := a.logOnlyOnce.LoadOrStore(r.Host, struct{}{}); !logged {
log.Printf("Domain not allowed: %s\n", r.Host)
internal.Logger.Printf("Domain not allowed: %s\n", r.Host)
}
r.Cancel()
return