1
0
mirror of https://github.com/labstack/echo.git synced 2025-03-19 21:17:58 +02:00

Refactored debug mode api

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2015-09-13 10:03:20 -07:00
parent 71ae409ea7
commit 3bd10bd651
4 changed files with 12 additions and 7 deletions

11
echo.go

@ -250,9 +250,14 @@ func (e *Echo) SetRenderer(r Renderer) {
e.renderer = r
}
// Debug enables debug mode.
func (e *Echo) Debug() {
e.debug = true
// SetDebug enables/disables debug mode.
func (e *Echo) SetDebug(on bool) {
e.debug = on
}
// Debug returns debug mode (enabled or disabled).
func (e *Echo) Debug() bool {
return e.debug
}
// StripTrailingSlash enables removing trailing slash from the request path.

@ -33,7 +33,7 @@ func TestEcho(t *testing.T) {
assert.NotNil(t, e.Router())
// Debug
e.Debug()
e.SetDebug(true)
assert.True(t, e.debug)
// DefaultHTTPErrorHandler

@ -11,7 +11,7 @@ import (
func TestRecover(t *testing.T) {
e := echo.New()
e.Debug()
e.SetDebug(true)
req, _ := http.NewRequest(echo.GET, "/", nil)
rec := httptest.NewRecorder()
c := echo.NewContext(req, echo.NewResponse(rec), e)

@ -42,9 +42,9 @@ and message `HTTPError.Message`.
### Debug
`Echo.Debug()`
`Echo.SetDebug(on bool)`
Enables debug mode.
Enables/disables debug mode.
### Disable colored log