File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package middleware
3
3
import (
4
4
"bytes"
5
5
"encoding/json"
6
+ "fmt"
6
7
"io"
7
8
"strconv"
8
9
"strings"
41
42
// - user_agent
42
43
// - status
43
44
// - error
45
+ // - error_stacktrace (err passed through Sprintf's '%+v')
44
46
// - latency (In nanoseconds)
45
47
// - latency_human (Human readable)
46
48
// - bytes_in (Bytes received)
@@ -198,8 +200,12 @@ func LoggerWithConfig(config LoggerConfig) echo.MiddlewareFunc {
198
200
if err != nil {
199
201
// Error may contain invalid JSON e.g. `"`
200
202
b , _ := json .Marshal (err .Error ())
201
- b = b [1 : len (b )- 1 ]
202
- return buf .Write (b )
203
+ return buf .Write (b [1 : len (b )- 1 ])
204
+ }
205
+ case "error_stacktrace" :
206
+ if err != nil {
207
+ b , _ := json .Marshal (fmt .Sprintf ("%+v" , err ))
208
+ return buf .Write (b [1 : len (b )- 1 ])
203
209
}
204
210
case "latency" :
205
211
l := stop .Sub (start )
You can’t perform that action at this time.
0 commit comments