diff --git a/logger.go b/logger.go index 63229719..d020ee71 100644 --- a/logger.go +++ b/logger.go @@ -5,6 +5,18 @@ import ( "time" ) +func ErrorLogger() HandlerFunc { + return func(c *Context) { + defer func() { + if len(c.Errors) > 0 { + log.Println(c.Errors) + c.JSON(-1, c.Errors) + } + }() + c.Next() + } +} + func Logger() HandlerFunc { return func(c *Context) { diff --git a/validation.go b/validation.go index 610d10ac..501ee502 100644 --- a/validation.go +++ b/validation.go @@ -6,17 +6,6 @@ import ( "strings" ) -func (c *Context) ErrorRender() HandlerFunc { - return func(c *Context) { - defer func() { - if len(c.Errors) > 0 { - c.JSON(-1, c.Errors) - } - }() - c.Next() - } -} - func Validate(c *Context, obj interface{}) error { var err error