clean logwriter
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc 2024-06-05 21:31:34 +02:00
parent 606c42cd5e
commit 050de1a0b3

View File

@ -74,7 +74,7 @@ func (w *LokiWriter) Write(p []byte) (n int, err error) {
return 0, fmt.Errorf("failed to marshal payload: %w", err) return 0, fmt.Errorf("failed to marshal payload: %w", err)
} }
fmt.Printf("Sending payload to Loki: %s\n", string(payloadBytes)) //fmt.Printf("Sending payload to Loki: %s\n", string(payloadBytes))
req, err := http.NewRequest("POST", w.url, bytes.NewReader(payloadBytes)) req, err := http.NewRequest("POST", w.url, bytes.NewReader(payloadBytes))
if err != nil { if err != nil {
@ -88,7 +88,7 @@ func (w *LokiWriter) Write(p []byte) (n int, err error) {
} }
defer resp.Body.Close() defer resp.Body.Close()
fmt.Printf("Loki response status: %d\n", resp.StatusCode) //fmt.Printf("Loki response status: %d\n", resp.StatusCode)
if resp.StatusCode != http.StatusNoContent { if resp.StatusCode != http.StatusNoContent {
return 0, fmt.Errorf("received non-204 response from Loki: %d", resp.StatusCode) return 0, fmt.Errorf("received non-204 response from Loki: %d", resp.StatusCode)
} }