Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-04 17:59:14 +03:00
parent b1150c5ef7
commit 94244b194a
7 changed files with 506 additions and 46 deletions

View File

@@ -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")