mirror of
https://github.com/hanzoai/oxy.git
synced 2026-09-30 23:42:31 +00:00
Cleanup logging
This commit is contained in:
+1
-1
@@ -90,7 +90,7 @@ func (f *Forwarder) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
f.log.Infof("Forward to %v, code: %v, duration: %v",
|
||||
f.log.Infof("Got response from %v, code: %v, duration: %v",
|
||||
req.URL, response.StatusCode, time.Now().UTC().Sub(start))
|
||||
|
||||
utils.CopyHeaders(w.Header(), response.Header)
|
||||
|
||||
@@ -241,7 +241,6 @@ func (s *Streamer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
defer b.Close()
|
||||
|
||||
s.next.ServeHTTP(b, outreq)
|
||||
s.log.Infof("next responded: %v", b.code)
|
||||
|
||||
reader, err := writer.Reader()
|
||||
if err != nil {
|
||||
|
||||
@@ -83,7 +83,6 @@ func responseCode() toInt {
|
||||
// IsNetworkError returns a predicate that returns true if last attempt ended with network error.
|
||||
func isNetworkError() hpredicate {
|
||||
return func(c *context) bool {
|
||||
c.log.Infof("code: %v", c.responseCode)
|
||||
return c.responseCode == http.StatusBadGateway || c.responseCode == http.StatusGatewayTimeout
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,6 @@ type Logger interface {
|
||||
Infof(format string, args ...interface{})
|
||||
Warningf(format string, args ...interface{})
|
||||
Errorf(format string, args ...interface{})
|
||||
|
||||
Info(message string)
|
||||
Error(message string)
|
||||
Warning(message string)
|
||||
}
|
||||
|
||||
type FileLogger struct {
|
||||
@@ -60,27 +56,6 @@ func (f *FileLogger) Errorf(format string, args ...interface{}) {
|
||||
f.error.Printf(format, args...)
|
||||
}
|
||||
|
||||
func (f *FileLogger) Info(message string) {
|
||||
if f.info == nil {
|
||||
return
|
||||
}
|
||||
f.info.Print(message)
|
||||
}
|
||||
|
||||
func (f *FileLogger) Warning(message string) {
|
||||
if f.warn == nil {
|
||||
return
|
||||
}
|
||||
f.warn.Print(message)
|
||||
}
|
||||
|
||||
func (f *FileLogger) Error(message string) {
|
||||
if f.error == nil {
|
||||
return
|
||||
}
|
||||
f.error.Print(message)
|
||||
}
|
||||
|
||||
type NOPLogger struct {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user