diff options
author | Mike Crute <mike@crute.us> | 2023-11-12 10:51:33 -0800 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2023-11-12 10:51:33 -0800 |
commit | aaebdc0a79968e68ab24dc1a98fa45607d74f30c (patch) | |
tree | f735a9441e66e24094c6cf488b199e9ec1049dd1 | |
parent | df94fb93b6d07cb74d1287225b76a620c6291e7a (diff) | |
download | golib-aaebdc0a79968e68ab24dc1a98fa45607d74f30c.tar.bz2 golib-aaebdc0a79968e68ab24dc1a98fa45607d74f30c.tar.xz golib-aaebdc0a79968e68ab24dc1a98fa45607d74f30c.zip |
echo: allow trace without debugecho/v0.16.2
-rw-r--r-- | echo/echo_default.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/echo/echo_default.go b/echo/echo_default.go index b6d4fa2..dadeb90 100644 --- a/echo/echo_default.go +++ b/echo/echo_default.go | |||
@@ -72,6 +72,7 @@ type EchoConfig struct { | |||
72 | DisableHttp3 bool | 72 | DisableHttp3 bool |
73 | PrometheusConfig *prometheus.PrometheusConfig | 73 | PrometheusConfig *prometheus.PrometheusConfig |
74 | CORSConfig *middleware.CORSConfig | 74 | CORSConfig *middleware.CORSConfig |
75 | EnableTrace bool | ||
75 | } | 76 | } |
76 | 77 | ||
77 | type EchoWrapper struct { | 78 | type EchoWrapper struct { |
@@ -92,10 +93,6 @@ func NewEchoWrapper(ctx context.Context, debug bool) (*EchoWrapper, error) { | |||
92 | e := echo.New() | 93 | e := echo.New() |
93 | e.Debug = debug | 94 | e.Debug = debug |
94 | 95 | ||
95 | if e.Debug { | ||
96 | glmw.RegisterPprof(e) | ||
97 | } | ||
98 | |||
99 | e.Logger.SetLevel(log.INFO) | 96 | e.Logger.SetLevel(log.INFO) |
100 | if debug { | 97 | if debug { |
101 | e.Logger.SetLevel(log.DEBUG) | 98 | e.Logger.SetLevel(log.DEBUG) |
@@ -166,6 +163,10 @@ func (w *EchoWrapper) AddErrorHandler(h ContentErrorHandler, mime ...string) { | |||
166 | } | 163 | } |
167 | 164 | ||
168 | func (w *EchoWrapper) Configure(c EchoConfig) (err error) { | 165 | func (w *EchoWrapper) Configure(c EchoConfig) (err error) { |
166 | if w.Debug || c.EnableTrace { | ||
167 | glmw.RegisterPprof(w.Echo) | ||
168 | } | ||
169 | |||
169 | w.configureAutocert(&c) | 170 | w.configureAutocert(&c) |
170 | 171 | ||
171 | if err := w.configureIpExtractor(&c); err != nil { | 172 | if err := w.configureIpExtractor(&c); err != nil { |