add debug log

This commit is contained in:
Дмитрий Саенко 2025-10-23 18:00:37 +03:00
parent f13165feea
commit 5ea900ff48

View file

@ -2495,6 +2495,16 @@ func (s *InboundService) syncWithSlaves(method string, path string, contentType
} }
defer resp.Body.Close() defer resp.Body.Close()
logger.Debugf("Request URL: %s", req.URL.String())
if req.Body != nil {
bodyBytes, err := io.ReadAll(req.Body)
if err != nil {
logger.Warningf("Failed to read request body: %v", err)
} else {
logger.Debugf("Request body: %s", string(bodyBytes))
}
}
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {
bodyBytes, _ := io.ReadAll(resp.Body) bodyBytes, _ := io.ReadAll(resp.Body)
logger.Warningf("Failed to sync with server %s. Status: %s, Body: %s", server.Name, resp.Status, string(bodyBytes)) logger.Warningf("Failed to sync with server %s. Status: %s, Body: %s", server.Name, resp.Status, string(bodyBytes))