Merge: * querylog, stats: don't print unnecessary log messages

Close #1039

* commit 'c9b4a0742ffa13d831240b53b67559999b183cf7':
  * querylog, stats: don't print unnecessary log messages
This commit is contained in:
Simon Zolin 2019-10-07 13:45:02 +03:00
commit 652816ceb1
2 changed files with 6 additions and 4 deletions

View File

@ -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)
}

View File

@ -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")