From 71d36d63fe092aa0470111d659c59295288c0115 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Mon, 2 Oct 2023 21:57:07 +0300 Subject: [PATCH] feat: Add TAG to logging from auth --- auth.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/auth.go b/auth.go index a88dc93..6409824 100644 --- a/auth.go +++ b/auth.go @@ -5,6 +5,9 @@ import ( "net/http" ) +// Java like +const TAG = "[ Auth ]" + type AuthHandler struct { Handler http.Handler } @@ -14,7 +17,7 @@ func (l *AuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { AuthHeader := r.Header.Get("Authorization") RealIP := r.Header.Get("X-Real-IP") if AuthHeader != task.Auth { - log.Printf("Dropping request from %s.", RealIP) + log.Printf("%s Dropping request from %s", TAG, RealIP) return // drop } l.Handler.ServeHTTP(w, r)