mirror of https://github.com/goproxyio/goproxy
print less log
parent
49360a363a
commit
f4b9da88f3
1
main.go
1
main.go
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue