We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 226e4f0 commit de29d3fCopy full SHA for de29d3f
middleware/logger.go
@@ -41,6 +41,7 @@ type (
41
// - user_agent
42
// - status
43
// - error
44
+ // - error_stacktrace (err passed through Sprintf's '%+v')
45
// - latency (In nanoseconds)
46
// - latency_human (Human readable)
47
// - bytes_in (Bytes received)
@@ -198,8 +199,12 @@ func LoggerWithConfig(config LoggerConfig) echo.MiddlewareFunc {
198
199
if err != nil {
200
// Error may contain invalid JSON e.g. `"`
201
b, _ := json.Marshal(err.Error())
- b = b[1 : len(b)-1]
202
- return buf.Write(b)
+ return buf.Write(b[1 : len(b)-1])
203
+ }
204
+ case "error_stacktrace":
205
+ if err != nil {
206
+ b, _ := json.Marshal(fmt.Sprintf("%+v", err))
207
208
}
209
case "latency":
210
l := stop.Sub(start)
0 commit comments