prometheus-fail2ban-exporter/collector/textfile/writer.go
Markus Pesch 3998f9e2c2
All checks were successful
continuous-integration/drone/push Build is passing
Initial Commit
2023-10-02 12:50:34 +02:00

21 lines
382 B
Go

package textfile
import (
"log"
"net/http"
)
func (c *Collector) WriteTextFileMetrics(w http.ResponseWriter, r *http.Request) {
if !c.enabled {
return
}
for _, f := range c.fileMap {
_, err := w.Write(f.fileContents)
if err != nil {
c.appendErrorForPath(f.fileName)
log.Printf("error writing file contents to response writer '%s': %v", f.fileName, err)
}
}
}