Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -59,6 +60,9 @@ func RequestLogger(next http.Handler) http.Handler {
|
||||
|
||||
log.Printf("⬅️ %s %s | status=%d | %s", r.Method, r.URL.Path, sw.status, time.Since(start))
|
||||
|
||||
// High-frequency endpoints: skip route_access audit to reduce DB/log pressure.
|
||||
skipAudit := r.Method == http.MethodGet && strings.HasPrefix(r.URL.Path, "/api/product-images")
|
||||
|
||||
// ---------- AUDIT (route_access) ----------
|
||||
al := auditlog.ActivityLog{
|
||||
ActionType: "route_access",
|
||||
@@ -95,9 +99,9 @@ func RequestLogger(next http.Handler) http.Handler {
|
||||
al.ErrorMessage = http.StatusText(sw.status)
|
||||
}
|
||||
|
||||
// ✅ ESKİ: auditlog.Write(al)
|
||||
// ✅ YENİ:
|
||||
auditlog.Enqueue(r.Context(), al)
|
||||
if !skipAudit {
|
||||
auditlog.Enqueue(r.Context(), al)
|
||||
}
|
||||
|
||||
if claims == nil {
|
||||
log.Println("⚠️ LOGGER: claims is NIL")
|
||||
|
||||
Reference in New Issue
Block a user