MCPcopy
hub / github.com/gin-gonic/gin / ErrorLoggerT

Function ErrorLoggerT

logger.go:212–220  ·  logger.go::ErrorLoggerT

ErrorLoggerT returns a HandlerFunc for a given error type.

(typ ErrorType)

Source from the content-addressed store, hash-verified

210
211// ErrorLoggerT returns a HandlerFunc for a given error type.
212func 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.

Callers 1

ErrorLoggerFunction · 0.85

Calls 3

NextMethod · 0.80
ByTypeMethod · 0.80
JSONMethod · 0.45

Tested by

no test coverage detected