ErrorLoggerT returns a HandlerFunc for a given error type.
(typ ErrorType)
| 210 | |
| 211 | // ErrorLoggerT returns a HandlerFunc for a given error type. |
| 212 | func ErrorLoggerT(typ ErrorType) HandlerFunc { |
| 213 | return func(c *Context) { |
| 214 | c.Next() |
| 215 | errors := c.Errors.ByType(typ) |
| 216 | if len(errors) > 0 { |
| 217 | c.JSON(-1, errors) |
| 218 | } |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | // Logger instances a Logger middleware that will write the logs to gin.DefaultWriter. |
| 223 | // By default, gin.DefaultWriter = os.Stdout. |
no test coverage detected