Skip to content

Commit

Permalink
Merge pull request #7 from saucelabs/dans-proxy-log
Browse files Browse the repository at this point in the history
Reducing proxy log level
  • Loading branch information
waggledans authored Apr 17, 2022
2 parents d2fc90a + c8ad4fc commit 84dcb2b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ func New(
}

p.proxy.OnRequest().HandleConnectFunc(func(host string, ctx *goproxy.ProxyCtx) (*goproxy.ConnectAction, string) {
logger.Get().Infolnf("%s %s -> %s", ctx.Req.Method, ctx.Req.RemoteAddr, ctx.Req.Host)
logger.Get().Debuglnf("%s %s -> %s", ctx.Req.Method, ctx.Req.RemoteAddr, ctx.Req.Host)
logger.Get().Debuglnf("%q", dumpHeaders(ctx.Req))

if err := p.setupHandlers(ctx); err != nil {
Expand All @@ -691,8 +691,8 @@ func New(
})

p.proxy.OnRequest().DoFunc(func(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) {
logger.Get().Infolnf("%s %s -> %s", req.Method, req.RemoteAddr, req.Host)
logger.Get().Debuglnf("%q", dumpHeaders(ctx.Req))
logger.Get().Debuglnf("%s %s -> %s", req.Method, req.RemoteAddr, req.Host)
logger.Get().Tracelnf("%q", dumpHeaders(ctx.Req))

if err := p.setupHandlers(ctx); err != nil {
logger.Get().Errorlnf("Failed to setup handler (HTTP) for request %s. %+v", ctx.Req.URL.Redacted(), err)
Expand All @@ -709,7 +709,7 @@ func New(
})

p.proxy.OnResponse().DoFunc(func(resp *http.Response, ctx *goproxy.ProxyCtx) *http.Response {
logger.Get().Infolnf("%s <- %s %v (%v bytes)",
logger.Get().Debuglnf("%s <- %s %v (%v bytes)",
resp.Request.RemoteAddr, resp.Request.Host, resp.Status, resp.ContentLength)

return resp
Expand Down

0 comments on commit 84dcb2b

Please sign in to comment.