print less log

pull/97/head
kun 2019-08-06 09:41:51 +08:00
parent 49360a363a
commit f4b9da88f3
2 changed files with 2 additions and 3 deletions

View File

@ -126,7 +126,6 @@ func (r *responseLogger) WriteHeader(code int) {
r.ResponseWriter.WriteHeader(code) r.ResponseWriter.WriteHeader(code)
} }
func (l *logger) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (l *logger) ServeHTTP(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(os.Stderr, "------ --- %s\n", r.URL)
start := time.Now() start := time.Now()
rl := &responseLogger{code: 200, ResponseWriter: w} rl := &responseLogger{code: 200, ResponseWriter: w}
l.h.ServeHTTP(rl, r) l.h.ServeHTTP(rl, r)

View File

@ -60,11 +60,11 @@ func (rt *Router) Direct(path string) bool {
func (rt *Router) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (rt *Router) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if rt.proxy != nil && rt.Direct(r.URL.Path) { if rt.proxy != nil && rt.Direct(r.URL.Path) {
fmt.Fprintf(os.Stdout, "[direct] %s\n", r.URL) fmt.Fprintf(os.Stderr, "------ --- %s [direct]\n", r.URL)
rt.srv.ServeHTTP(w, r) rt.srv.ServeHTTP(w, r)
return return
} }
fmt.Fprintf(os.Stdout, "[proxy] %s\n", r.URL) fmt.Fprintf(os.Stderr, "------ --- %s [proxy]\n", r.URL)
rt.proxy.ServeHTTP(w, r) rt.proxy.ServeHTTP(w, r)
return return
} }