From 56949ae7312c631ab77948b916d9a94a05ce96ad Mon Sep 17 00:00:00 2001 From: valitovgaziz Date: Thu, 16 Oct 2025 10:00:02 +0500 Subject: [PATCH] modified: serv_nginx/api_bb/internal/handlers/news_handler.go log createNews method auth --- serv_nginx/api_bb/internal/handlers/news_handler.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/serv_nginx/api_bb/internal/handlers/news_handler.go b/serv_nginx/api_bb/internal/handlers/news_handler.go index 0c4b251..593c4c9 100644 --- a/serv_nginx/api_bb/internal/handlers/news_handler.go +++ b/serv_nginx/api_bb/internal/handlers/news_handler.go @@ -81,7 +81,12 @@ func (h *NewsHandler) CreateNews(w http.ResponseWriter, r *http.Request) { userID, ok := r.Context().Value(middleware.UserIDKey).(uint) logger.Get().Info("userID", zap.Uint("userID", userID)) if !ok { - fmt.Printf("userid %d", userID) + h.logger.Warn("Failed to get userID from context in CreateReview", + zap.String("path", r.URL.Path), + zap.String("method", r.Method), + zap.String("remote_addr", r.RemoteAddr), + zap.Uint("userID", userID), + ) utils.RespondWithError(w, http.StatusUnauthorized, "Unauthorized") return }