From 1113635c31d75f80dd47ea41704e009391ed7cff Mon Sep 17 00:00:00 2001 From: xtrafrancyz Date: Wed, 22 Aug 2018 00:21:59 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD=20?= =?UTF-8?q?=D0=BB=D0=BE=D0=B3=20=D0=BF=D1=80=D0=B8=20=D0=BE=D1=88=D0=B8?= =?UTF-8?q?=D0=B1=D0=BA=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/proxy.go b/proxy.go index ff675d1..178cb7b 100644 --- a/proxy.go +++ b/proxy.go @@ -122,8 +122,10 @@ func (p *Proxy) handleProxy(ctx *fasthttp.RequestCtx) { err = p.processProxyResponse(baseDomain, ctx) } + elapsed := time.Since(start).Round(100 * time.Microsecond) + if err != nil { - ctx.Logger().Printf("error when proxying the request: %s", err) + log.Printf("%s %s error: %s", elapsed, ctx.Path(), err) if strings.Contains(err.Error(), "timed out") || strings.Contains(err.Error(), "timeout") { ctx.Error("408 Request Timeout", 408) } else { @@ -143,7 +145,6 @@ func (p *Proxy) handleProxy(ctx *fasthttp.RequestCtx) { p.tracker.trackRequest(string(ip), len(ctx.Response.Body())) } - elapsed := time.Since(start).Round(100 * time.Microsecond) if p.config.LogVerbosity == 2 { log.Printf("%s %s %s", elapsed, ctx.Path(), bytefmt.ByteSize(uint64(len(ctx.Response.Body())))) } else if p.config.LogVerbosity == 3 {