1
0
mirror of https://github.com/labstack/echo.git synced 2024-11-24 08:22:21 +02:00

Fixed #84 - Added API to disable the colored log

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2015-07-12 21:40:27 -07:00
parent 3c917b4c11
commit 4b229cab83

15
echo.go
View File

@ -15,8 +15,9 @@ import (
"sync"
"encoding/xml"
"github.com/bradfitz/http2"
"github.com/mattn/go-colorable"
"github.com/labstack/gommon/color"
"golang.org/x/net/websocket"
)
@ -156,6 +157,9 @@ func New() (e *Echo) {
// Defaults
//----------
if runtime.GOOS == "windows" {
color.Disable()
}
e.HTTP2(false)
e.notFoundHandler = func(c *Context) error {
return NewHTTPError(http.StatusNotFound)
@ -191,6 +195,11 @@ func (e *Echo) Router() *Router {
return e.router
}
// DisableColoredLog disables colored log.
func (e *Echo) DisableColoredLog() {
color.Disable()
}
// HTTP2 enables HTTP2 support.
func (e *Echo) HTTP2(on bool) {
e.http2 = on
@ -569,7 +578,3 @@ func wrapHandler(h Handler) HandlerFunc {
panic("echo => unknown handler")
}
}
func init() {
log.SetOutput(colorable.NewColorableStdout())
}