diff --git a/main.go b/main.go index 8c5eed1..20e939b 100644 --- a/main.go +++ b/main.go @@ -83,9 +83,9 @@ func main() { var handle http.Handler if proxyHost != "" { - fmt.Fprintf(os.Stderr, "ProxyHost %s\n", proxyHost) + log.Printf("ProxyHost %s\n", proxyHost) if excludeHost != "" { - fmt.Fprintf(os.Stderr, "ExcludeHost %s\n", excludeHost) + log.Printf("ExcludeHost %s\n", excludeHost) } handle = &logger{proxy.NewRouter(proxy.NewServer(new(ops)), &proxy.RouterOptions{ Pattern: excludeHost, @@ -129,7 +129,7 @@ func (l *logger) ServeHTTP(w http.ResponseWriter, r *http.Request) { start := time.Now() rl := &responseLogger{code: 200, ResponseWriter: w} l.h.ServeHTTP(rl, r) - fmt.Fprintf(os.Stderr, "%.3fs %d %s\n", time.Since(start).Seconds(), rl.code, r.URL) + log.Printf("%.3fs %d %s\n", time.Since(start).Seconds(), rl.code, r.URL) } // An ops is a proxy.ServerOps implementation. diff --git a/proxy/router.go b/proxy/router.go index 1a8f7ae..e69daf1 100644 --- a/proxy/router.go +++ b/proxy/router.go @@ -2,11 +2,10 @@ package proxy import ( "crypto/tls" - "fmt" + "log" "net/http" "net/http/httputil" "net/url" - "os" "path" "strings" ) @@ -59,11 +58,11 @@ func (rt *Router) Direct(path string) bool { func (rt *Router) ServeHTTP(w http.ResponseWriter, r *http.Request) { if rt.proxy != nil && rt.Direct(r.URL.Path) { - fmt.Fprintf(os.Stderr, "------ --- %s [direct]\n", r.URL) + log.Printf("------ --- %s [direct]\n", r.URL) rt.srv.ServeHTTP(w, r) return } - fmt.Fprintf(os.Stderr, "------ --- %s [proxy]\n", r.URL) + log.Printf("------ --- %s [proxy]\n", r.URL) rt.proxy.ServeHTTP(w, r) return }