From b6f2972dedc0c891514aa3735a3d19219c693d39 Mon Sep 17 00:00:00 2001 From: Tom Czarniecki Date: Tue, 1 Jun 2021 05:31:48 +1000 Subject: [PATCH] logging cleanup --- scraper.go | 2 +- server.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scraper.go b/scraper.go index 3b2bb30..0c26ca2 100644 --- a/scraper.go +++ b/scraper.go @@ -156,7 +156,7 @@ func (s *Scraper) scrape() bool { ret := true for _, q := range queries { if err := scrapeQuery(l, q); err != nil { - s.log.WithError(err).Warn("query failed") + s.log.WithError(err).WithField("filter", q.searchFilter).Warn("query failed") ret = false } } diff --git a/server.go b/server.go index 7d9d0da..f6f11fd 100644 --- a/server.go +++ b/server.go @@ -73,12 +73,12 @@ func (s *Server) adaptor(kvs ...interface{}) error { key := fmt.Sprint(kvs[i]) fields[key] = kvs[i+1] } - msg := "" + var msg string if val, ok := fields["msg"]; ok { delete(fields, "msg") msg = fmt.Sprint(val) } - level := "info" + var level string if val, ok := fields["level"]; ok { delete(fields, "level") level = fmt.Sprint(val)