From 16fc55f38efcee83cc732184dd7592f7dcbe6a41 Mon Sep 17 00:00:00 2001 From: Tyler Date: Sun, 7 Mar 2021 00:02:55 -0500 Subject: [PATCH] More debugging! --- main.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/main.go b/main.go index 94d1704..7ded826 100644 --- a/main.go +++ b/main.go @@ -106,11 +106,17 @@ func scanHandler(w http.ResponseWriter, r *http.Request) { wg.Done() } + log.WithField("contentType", contentType).Debug("Adding files from multipart form as jobs") + + fileCount := 0 + for _, files := range r.MultipartForm.File { // Append files for _, file := range files { wg.Add(1) + fileCount++ + f, err := file.Open() if err != nil { @@ -126,6 +132,8 @@ func scanHandler(w http.ResponseWriter, r *http.Request) { } } + log.WithField("count", fileCount).Debug("Waiting for jobs to finish") + wg.Wait() json.NewEncoder(w).Encode(results) @@ -137,6 +145,8 @@ func scanHandler(w http.ResponseWriter, r *http.Request) { }, } + log.WithField("contentType", contentType).Debug("Scanning contents of body") + jobChan <- job } } @@ -204,6 +214,8 @@ func worker(rules *yara.Rules) { for { job := <-jobChan + log.Debug("Processing job") + processJob(s, job) } }