From 7d11cd9d6a4e62dc75a33a42ca5f704a058d1450 Mon Sep 17 00:00:00 2001 From: "wim.de.jager" Date: Mon, 21 Jun 2021 16:28:55 +0200 Subject: [PATCH] Log errors, requests --- clamrest.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clamrest.go b/clamrest.go index d96e372..5bfd301 100644 --- a/clamrest.go +++ b/clamrest.go @@ -25,6 +25,8 @@ type Error struct { } func writeError(w http.ResponseWriter, statusCode int, err string) { + log.Printf(time.Now().Format(time.RFC3339) + "ERROR: " + err) + w.Header().Set("Content-Type", "application/json; charset=utf-8") w.WriteHeader(statusCode) @@ -90,6 +92,8 @@ func scanHandler(w http.ResponseWriter, r *http.Request) { switch r.Method { //POST takes the uploaded file(s) and saves it to disk. case "POST": + log.Printf(time.Now().Format(time.RFC3339) + "Received scan request " + r.RequestURI) + c := clamd.NewClamd(opts["CLAMD_PORT"]) //get the multipart reader for the request. reader, err := r.MultipartReader()