Stops spamming the log with missing servers

This commit is contained in:
A. Svensson 2017-08-14 17:01:41 +02:00
parent 8ba561d8f2
commit 0f4a744dad
2 changed files with 12 additions and 13 deletions

View File

@ -40,6 +40,7 @@ func (a *App) renderChart(w http.ResponseWriter, c renderableChart) error {
} }
func makeHistoryChart(title string, points []ServerPoint) chart.Chart { func makeHistoryChart(title string, points []ServerPoint) chart.Chart {
// TODO BUG: one day is missing randomly (usually the 3rd day in the range) in the chart
var xVals []time.Time var xVals []time.Time
var yVals []float64 var yVals []float64
for _, p := range points { for _, p := range points {

View File

@ -2,9 +2,7 @@ package ss13_se
import ( import (
"fmt" "fmt"
"log"
"net/http" "net/http"
"time"
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )
@ -23,9 +21,9 @@ type handlerVars map[string]string
type handler func(http.ResponseWriter, *http.Request, handlerVars) error type handler func(http.ResponseWriter, *http.Request, handlerVars) error
func (h handler) ServeHTTP(rw http.ResponseWriter, req *http.Request) { func (h handler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
start := time.Now() //start := time.Now()
err := h(rw, req, mux.Vars(req)) err := h(rw, req, mux.Vars(req))
dur := time.Since(start) //dur := time.Since(start)
if err != nil { if err != nil {
switch e := err.(type) { switch e := err.(type) {
@ -37,13 +35,13 @@ func (h handler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
} }
} }
log.Printf("%s %s \t%s \terr: %v\n", //log.Printf("%s %s \t%s \terr: %v\n",
//req.RemoteAddr, //req.RemoteAddr,
req.Method, //req.Method,
req.URL.String(), //req.URL.String(),
//req.UserAgent(), //req.UserAgent(),
dur, //dur,
//resp.Status, //resp.Status,
err, //err,
) //)
} }