1
0
mirror of https://github.com/labstack/echo.git synced 2025-01-24 03:16:14 +02:00

Merge pull request #202 from labstack/debug-api-changes

Debug api changes
This commit is contained in:
Vishal Rana 2015-09-13 10:41:37 -07:00
commit 68e00e964c
5 changed files with 13 additions and 7 deletions

View File

@ -1,5 +1,6 @@
language: go
go:
- 1.4
- tip
before_install:
- go get github.com/modocache/gover

11
echo.go
View File

@ -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.

View File

@ -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

View File

@ -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)

View File

@ -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