1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00

Custom logger for graceful

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-09-25 11:56:51 -07:00
parent dd22cf9593
commit 335b1d0622
2 changed files with 6 additions and 6 deletions

10
echo.go
View File

@ -43,6 +43,7 @@ import (
"errors"
"fmt"
"io"
slog "log"
"net/http"
"path"
"reflect"
@ -237,12 +238,14 @@ func New() (e *Echo) {
// TODO: https://github.com/golang/go/commit/d24f446a90ea94b87591bf16228d7d871fec3d92
TLSConfig: new(tls.Config),
ShutdownTimeout: 15 * time.Second,
Logger: glog.New("echo"),
maxParam: new(int),
gracefulTLS: new(graceful.Server),
}
e.Logger.SetLevel(glog.OFF)
e.graceful = &graceful.Server{
Timeout: e.ShutdownTimeout,
Logger: graceful.DefaultLogger(),
Logger: slog.New(e.Logger.Output(), "echo: ", 0),
}
*e.gracefulTLS = *e.graceful
e.pool.New = func() interface{} {
@ -251,11 +254,6 @@ func New() (e *Echo) {
e.router = NewRouter(e)
e.HTTPErrorHandler = e.DefaultHTTPErrorHandler
e.Binder = &binder{}
l := glog.New("echo")
l.SetLevel(glog.OFF)
e.Logger = l
e.graceful.Logger.SetOutput(l.Output())
e.gracefulTLS.Logger.SetOutput(l.Output())
return
}

View File

@ -9,7 +9,9 @@ import (
type (
// Logger defines the logging interface.
Logger interface {
Output() io.Writer
SetOutput(io.Writer)
Level() log.Lvl
SetLevel(log.Lvl)
Print(...interface{})
Printf(string, ...interface{})