From 40dc444270f1d12fa112f0f07900bb4c6d2816cf Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Mon, 30 Jun 2014 03:59:21 +0200 Subject: [PATCH] Renames ErrorRender() to ErrorLogger() --- logger.go | 12 ++++++++++++ validation.go | 11 ----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/logger.go b/logger.go index 6322971..d020ee7 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 610d10a..501ee50 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