@@ -32,26 +32,33 @@ default values for `DisableStackAll` and `DisablePrintStack`.
32
32
## Configuration
33
33
34
34
``` go
35
+ // LogErrorFunc defines a function for custom logging in the middleware.
36
+ LogErrorFunc func (c echo.Context , err error , stack []byte ) error
37
+
35
38
RecoverConfig struct {
36
39
// Skipper defines a function to skip middleware.
37
40
Skipper Skipper
38
41
39
42
// Size of the stack to be printed.
40
43
// Optional. Default value 4KB.
41
- StackSize int ` json :"stack_size"`
44
+ StackSize int ` yaml :"stack_size"`
42
45
43
46
// DisableStackAll disables formatting stack traces of all other goroutines
44
47
// into buffer after the trace for the current goroutine.
45
48
// Optional. Default value false.
46
- DisableStackAll bool ` json :"disable_stack_all"`
49
+ DisableStackAll bool ` yaml :"disable_stack_all"`
47
50
48
51
// DisablePrintStack disables printing stack trace.
49
52
// Optional. Default value as false.
50
- DisablePrintStack bool ` json :"disable_print_stack"`
53
+ DisablePrintStack bool ` yaml :"disable_print_stack"`
51
54
52
55
// LogLevel is log level to printing stack trace.
53
56
// Optional. Default value 0 (Print).
54
57
LogLevel log.Lvl
58
+
59
+ // LogErrorFunc defines a function for custom logging in the middleware.
60
+ // If it's set you don't need to provide LogLevel for config.
61
+ LogErrorFunc LogErrorFunc
55
62
}
56
63
```
57
64
@@ -64,5 +71,6 @@ DefaultRecoverConfig = RecoverConfig{
64
71
DisableStackAll : false ,
65
72
DisablePrintStack : false ,
66
73
LogLevel : 0 ,
74
+ LogErrorFunc : nil ,
67
75
}
68
76
```
0 commit comments