1
0
mirror of https://github.com/labstack/echo.git synced 2024-11-28 08:38:39 +02:00

Refactored some functions

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2015-08-25 01:03:33 -07:00
parent 2450450a07
commit 9216043df5

20
echo.go
View File

@ -178,9 +178,9 @@ func New() (e *Echo) {
//----------
if runtime.GOOS == "windows" {
e.ColoredLog(false)
e.DisableColoredLog()
}
e.HTTP2(false)
e.HTTP2()
e.defaultHTTPErrorHandler = func(err error, c *Context) {
code := http.StatusInternalServerError
msg := http.StatusText(code)
@ -206,18 +206,14 @@ func (e *Echo) Router() *Router {
return e.router
}
// ColoredLog enable/disable colored log.
func (e *Echo) ColoredLog(on bool) {
if on {
color.Enable()
} else {
color.Disable()
}
// DisableColoredLog disables colored log.
func (e *Echo) DisableColoredLog() {
color.Disable()
}
// HTTP2 enable/disable HTTP2 support.
func (e *Echo) HTTP2(on bool) {
e.http2 = on
// HTTP2 enables HTTP2 support.
func (e *Echo) HTTP2() {
e.http2 = true
}
// DefaultHTTPErrorHandler invokes the default HTTP error handler.