mirror of
https://github.com/labstack/echo.git
synced 2024-12-24 20:14:31 +02:00
parent
f3ff6a1d10
commit
0d2dac7532
2
echo.go
2
echo.go
@ -264,7 +264,7 @@ func (e *Echo) SetLogOutput(w io.Writer) {
|
||||
e.logger.SetOutput(w)
|
||||
}
|
||||
|
||||
// SetLogLevel sets the log level for the logger. Default value is `glog.ERROR`.
|
||||
// SetLogLevel sets the log level for the logger. Default value `3` (ERROR).
|
||||
func (e *Echo) SetLogLevel(l uint8) {
|
||||
e.logger.SetLevel(l)
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/labstack/echo"
|
||||
"github.com/labstack/echo/engine"
|
||||
"github.com/labstack/gommon/log"
|
||||
"github.com/labstack/echo/log"
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
@ -19,12 +19,12 @@ type (
|
||||
*fasthttp.RequestCtx
|
||||
header engine.Header
|
||||
url engine.URL
|
||||
logger *log.Logger
|
||||
logger log.Logger
|
||||
}
|
||||
)
|
||||
|
||||
// NewRequest returns `Request` instance.
|
||||
func NewRequest(c *fasthttp.RequestCtx, l *log.Logger) *Request {
|
||||
func NewRequest(c *fasthttp.RequestCtx, l log.Logger) *Request {
|
||||
return &Request{
|
||||
RequestCtx: c,
|
||||
url: &URL{URI: c.URI()},
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/engine"
|
||||
"github.com/labstack/gommon/log"
|
||||
"github.com/labstack/echo/log"
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
@ -20,12 +20,12 @@ type (
|
||||
size int64
|
||||
committed bool
|
||||
writer io.Writer
|
||||
logger *log.Logger
|
||||
logger log.Logger
|
||||
}
|
||||
)
|
||||
|
||||
// NewResponse returns `Response` instance.
|
||||
func NewResponse(c *fasthttp.RequestCtx, l *log.Logger) *Response {
|
||||
func NewResponse(c *fasthttp.RequestCtx, l log.Logger) *Response {
|
||||
return &Response{
|
||||
RequestCtx: c,
|
||||
header: &ResponseHeader{ResponseHeader: &c.Response.Header},
|
||||
|
@ -7,7 +7,8 @@ import (
|
||||
|
||||
"github.com/labstack/echo"
|
||||
"github.com/labstack/echo/engine"
|
||||
"github.com/labstack/gommon/log"
|
||||
"github.com/labstack/echo/log"
|
||||
glog "github.com/labstack/gommon/log"
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
@ -17,7 +18,7 @@ type (
|
||||
*fasthttp.Server
|
||||
config engine.Config
|
||||
handler engine.Handler
|
||||
logger *log.Logger
|
||||
logger log.Logger
|
||||
pool *pool
|
||||
}
|
||||
|
||||
@ -81,7 +82,7 @@ func WithConfig(c engine.Config) (s *Server) {
|
||||
handler: engine.HandlerFunc(func(req engine.Request, res engine.Response) {
|
||||
s.logger.Error("handler not set, use `SetHandler()` to set it.")
|
||||
}),
|
||||
logger: log.New("echo"),
|
||||
logger: glog.New("echo"),
|
||||
}
|
||||
s.Handler = s.ServeHTTP
|
||||
return
|
||||
@ -93,7 +94,7 @@ func (s *Server) SetHandler(h engine.Handler) {
|
||||
}
|
||||
|
||||
// SetLogger implements `engine.Server#SetLogger` function.
|
||||
func (s *Server) SetLogger(l *log.Logger) {
|
||||
func (s *Server) SetLogger(l log.Logger) {
|
||||
s.logger = l
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/labstack/echo"
|
||||
"github.com/labstack/echo/engine"
|
||||
"github.com/labstack/gommon/log"
|
||||
"github.com/labstack/echo/log"
|
||||
)
|
||||
|
||||
type (
|
||||
@ -18,7 +18,7 @@ type (
|
||||
*http.Request
|
||||
header engine.Header
|
||||
url engine.URL
|
||||
logger *log.Logger
|
||||
logger log.Logger
|
||||
}
|
||||
)
|
||||
|
||||
@ -27,7 +27,7 @@ const (
|
||||
)
|
||||
|
||||
// NewRequest returns `Request` instance.
|
||||
func NewRequest(r *http.Request, l *log.Logger) *Request {
|
||||
func NewRequest(r *http.Request, l log.Logger) *Request {
|
||||
return &Request{
|
||||
Request: r,
|
||||
url: &URL{URL: r.URL},
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/engine"
|
||||
"github.com/labstack/gommon/log"
|
||||
"github.com/labstack/echo/log"
|
||||
)
|
||||
|
||||
type (
|
||||
@ -19,7 +19,7 @@ type (
|
||||
size int64
|
||||
committed bool
|
||||
writer io.Writer
|
||||
logger *log.Logger
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
responseAdapter struct {
|
||||
@ -29,7 +29,7 @@ type (
|
||||
)
|
||||
|
||||
// NewResponse returns `Response` instance.
|
||||
func NewResponse(w http.ResponseWriter, l *log.Logger) *Response {
|
||||
func NewResponse(w http.ResponseWriter, l log.Logger) *Response {
|
||||
return &Response{
|
||||
ResponseWriter: w,
|
||||
header: &Header{Header: w.Header()},
|
||||
|
@ -6,7 +6,8 @@ import (
|
||||
|
||||
"github.com/labstack/echo"
|
||||
"github.com/labstack/echo/engine"
|
||||
"github.com/labstack/gommon/log"
|
||||
"github.com/labstack/echo/log"
|
||||
glog "github.com/labstack/gommon/log"
|
||||
)
|
||||
|
||||
type (
|
||||
@ -15,7 +16,7 @@ type (
|
||||
*http.Server
|
||||
config engine.Config
|
||||
handler engine.Handler
|
||||
logger *log.Logger
|
||||
logger log.Logger
|
||||
pool *pool
|
||||
}
|
||||
|
||||
@ -79,7 +80,7 @@ func WithConfig(c engine.Config) (s *Server) {
|
||||
handler: engine.HandlerFunc(func(req engine.Request, res engine.Response) {
|
||||
s.logger.Error("handler not set, use `SetHandler()` to set it.")
|
||||
}),
|
||||
logger: log.New("echo"),
|
||||
logger: glog.New("echo"),
|
||||
}
|
||||
s.Addr = c.Address
|
||||
s.Handler = s
|
||||
@ -92,7 +93,7 @@ func (s *Server) SetHandler(h engine.Handler) {
|
||||
}
|
||||
|
||||
// SetLogger implements `engine.Server#SetLogger` function.
|
||||
func (s *Server) SetLogger(l *log.Logger) {
|
||||
func (s *Server) SetLogger(l log.Logger) {
|
||||
s.logger = l
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user