Skip to content

Commit 7b1fba7

Browse files
committed
Merge pull request #26 from lunny/master
disable per request log for tango
2 parents 3ae8223 + 4241aab commit 7b1fba7

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

routers.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package main
77
import (
88
"fmt"
99
"io"
10-
"io/ioutil"
1110
"log"
1211
"net/http"
1312
"os"
@@ -33,6 +32,7 @@ import (
3332
"github.com/gorilla/mux"
3433
"github.com/julienschmidt/httprouter"
3534
"github.com/labstack/echo"
35+
llog "github.com/lunny/log"
3636
"github.com/lunny/tango"
3737
vulcan "github.com/mailgun/route"
3838
"github.com/naoina/denco"
@@ -930,19 +930,21 @@ func tangoHandlerWrite(ctx *tango.Context) {
930930

931931
func initTango() {
932932
tango.Env = tango.Prod
933+
llog.SetOutput(new(mockResponseWriter))
934+
llog.SetOutputLevel(llog.Lnone)
933935
}
934936

935937
func loadTango(routes []route) http.Handler {
936-
tg := tango.NewWithLog(tango.NewLogger(ioutil.Discard))
938+
tg := tango.NewWithLog(llog.Std)
937939
for _, route := range routes {
938-
tg.Route([]string{route.method}, route.path, tangoHandler)
940+
tg.Route(route.method, route.path, tangoHandler)
939941
}
940942
return tg
941943
}
942944

943945
func loadTangoSingle(method, path string, handler func(*tango.Context)) http.Handler {
944-
tg := tango.NewWithLog(tango.NewLogger(ioutil.Discard))
945-
tg.Route([]string{method}, path, handler)
946+
tg := tango.NewWithLog(llog.Std)
947+
tg.Route(method, path, handler)
946948
return tg
947949
}
948950

0 commit comments

Comments
 (0)