🔊 Add WithLogger so we can log the rendered error
This commit is contained in:
parent
b4b4f041d7
commit
2324d738bc
3 changed files with 29 additions and 0 deletions
10
options.go
10
options.go
|
|
@ -8,13 +8,23 @@ import (
|
|||
)
|
||||
|
||||
type config struct {
|
||||
loggers []LoggerFunc
|
||||
transformers []Transformer
|
||||
}
|
||||
|
||||
type LoggerFunc func(*gin.Context, rErrors.ResponsableError)
|
||||
|
||||
type Transformer func(error) rErrors.ResponsableError
|
||||
|
||||
type Option func(config) config
|
||||
|
||||
func WithLogger(logger LoggerFunc) Option {
|
||||
return func(c config) config {
|
||||
c.loggers = append(c.loggers, logger)
|
||||
return c
|
||||
}
|
||||
}
|
||||
|
||||
func WithTransformer(tr Transformer) Option {
|
||||
return func(c config) config {
|
||||
c.transformers = append(c.transformers, tr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue