Add logging of queries

This commit is contained in:
Las Zenow 2014-02-11 14:41:50 +01:00
parent 80cc996fd6
commit 025314f8f8

View file

@ -1,5 +1,7 @@
package main
import log "github.com/cihub/seelog"
import (
"github.com/gorilla/mux"
"labix.org/v2/mgo/bson"
@ -23,6 +25,8 @@ func InitStats(database *DB) {
func GatherStats(function func(handler), database *DB) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
log.Info("Query ", r.Method, " ", r.RequestURI)
var h handler
h.db = database.Copy()
defer h.db.Close()