From c9b4a0742ffa13d831240b53b67559999b183cf7 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Mon, 7 Oct 2019 12:03:56 +0300 Subject: [PATCH] * querylog, stats: don't print unnecessary log messages --- querylog/qlog.go | 4 ++-- stats/stats_http.go | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/querylog/qlog.go b/querylog/qlog.go index b29c8dec..5465b7c6 100644 --- a/querylog/qlog.go +++ b/querylog/qlog.go @@ -62,12 +62,12 @@ func (l *queryLog) Clear() { l.logBufferLock.Unlock() err := os.Remove(l.logFile + ".1") - if err != nil { + if err != nil && !os.IsNotExist(err) { log.Error("file remove: %s: %s", l.logFile+".1", err) } err = os.Remove(l.logFile) - if err != nil { + if err != nil && !os.IsNotExist(err) { log.Error("file remove: %s: %s", l.logFile, err) } diff --git a/stats/stats_http.go b/stats/stats_http.go index d5f08ddc..e857ecc3 100644 --- a/stats/stats_http.go +++ b/stats/stats_http.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "net/http" + "time" "github.com/AdguardTeam/golibs/log" ) @@ -24,9 +25,10 @@ func (s *statsCtx) handleStats(w http.ResponseWriter, r *http.Request) { if s.limit/24 > 7 { units = Days } - counter := log.StartTimer() + + start := time.Now() d := s.getData(units) - counter.LogElapsed("Stats: prepared data") + log.Debug("Stats: prepared data in %v", time.Since(start)) if d == nil { httpError(r, w, http.StatusInternalServerError, "Couldn't get statistics data")