mirror of
https://github.com/labstack/echo.git
synced 2025-07-13 01:30:31 +02:00
5
echo.go
5
echo.go
@ -54,6 +54,7 @@ import (
|
|||||||
"golang.org/x/net/websocket"
|
"golang.org/x/net/websocket"
|
||||||
|
|
||||||
"github.com/labstack/echo/log"
|
"github.com/labstack/echo/log"
|
||||||
|
"github.com/labstack/gommon/color"
|
||||||
glog "github.com/labstack/gommon/log"
|
glog "github.com/labstack/gommon/log"
|
||||||
"github.com/tylerb/graceful"
|
"github.com/tylerb/graceful"
|
||||||
)
|
)
|
||||||
@ -517,7 +518,7 @@ func (e *Echo) Start(address string) (err error) {
|
|||||||
e.Server.Handler = e
|
e.Server.Handler = e
|
||||||
e.graceful.Server = e.Server
|
e.graceful.Server = e.Server
|
||||||
e.graceful.Addr = address
|
e.graceful.Addr = address
|
||||||
e.Logger.Printf(" ⇛ http server started on %s", e.Logger.Color().Green(address))
|
color.Printf(" ⇛ http server started on %s\n", color.Green(address))
|
||||||
return e.graceful.ListenAndServe()
|
return e.graceful.ListenAndServe()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +539,7 @@ func (e *Echo) StartTLS(address string, certFile, keyFile string) (err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
e.Logger.Printf(" ⇛ https server started on %s", e.Logger.Color().Green(address))
|
color.Printf(" ⇛ https server started on %s\n", color.Green(address))
|
||||||
return e.gracefulTLS.ListenAndServeTLSConfig(e.TLSConfig)
|
return e.gracefulTLS.ListenAndServeTLSConfig(e.TLSConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ func testMethod(t *testing.T, method, path string, e *Echo) {
|
|||||||
reflect.ValueOf(i).MethodByName(method).Call([]reflect.Value{p, h})
|
reflect.ValueOf(i).MethodByName(method).Call([]reflect.Value{p, h})
|
||||||
_, body := request(method, path, e)
|
_, body := request(method, path, e)
|
||||||
if body != method {
|
if body != method {
|
||||||
t.Errorf("expected body `%s`, got %s.", method, body)
|
t.Errorf("expected body `%s`, got %s", method, body)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
glide.lock
generated
8
glide.lock
generated
@ -1,10 +1,10 @@
|
|||||||
hash: 9b52073f044ab24c64a0f01e3efef2aabdeb7ca21abc9129d2ee7a0c995e4412
|
hash: 9b52073f044ab24c64a0f01e3efef2aabdeb7ca21abc9129d2ee7a0c995e4412
|
||||||
updated: 2016-09-24T12:47:09.052189516-07:00
|
updated: 2016-09-25T11:05:56.886149316-07:00
|
||||||
imports:
|
imports:
|
||||||
- name: github.com/dgrijalva/jwt-go
|
- name: github.com/dgrijalva/jwt-go
|
||||||
version: 24c63f56522a87ec5339cc3567883f1039378fdb
|
version: 24c63f56522a87ec5339cc3567883f1039378fdb
|
||||||
- name: github.com/labstack/gommon
|
- name: github.com/labstack/gommon
|
||||||
version: 35d2b9f99cc2aa9f89dce3ea318229c68769e182
|
version: 0e66403a8c305a543b9a53c21778a28536f836c0
|
||||||
subpackages:
|
subpackages:
|
||||||
- bytes
|
- bytes
|
||||||
- color
|
- color
|
||||||
@ -15,9 +15,11 @@ imports:
|
|||||||
- name: github.com/mattn/go-isatty
|
- name: github.com/mattn/go-isatty
|
||||||
version: 66b8e73f3f5cda9f96b69efd03dd3d7fc4a5cdb8
|
version: 66b8e73f3f5cda9f96b69efd03dd3d7fc4a5cdb8
|
||||||
- name: github.com/stretchr/testify
|
- name: github.com/stretchr/testify
|
||||||
version: dfaf6b82bc18869f659e7b42a5a768e48bda2429
|
version: 69483b4bd14f5845b5a1e55bca19e954e827f1d0
|
||||||
subpackages:
|
subpackages:
|
||||||
- assert
|
- assert
|
||||||
|
- name: github.com/tylerb/graceful
|
||||||
|
version: 50a48b6e73fcc75b45e22c05b79629a67c79e938
|
||||||
- name: github.com/valyala/fasthttp
|
- name: github.com/valyala/fasthttp
|
||||||
version: d03a22720925ae6fd6f81db717d9288fc2771d79
|
version: d03a22720925ae6fd6f81db717d9288fc2771d79
|
||||||
- name: github.com/valyala/fasttemplate
|
- name: github.com/valyala/fasttemplate
|
||||||
|
@ -3,8 +3,6 @@ package log
|
|||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/labstack/gommon/color"
|
|
||||||
|
|
||||||
"github.com/labstack/gommon/log"
|
"github.com/labstack/gommon/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -13,7 +11,6 @@ type (
|
|||||||
Logger interface {
|
Logger interface {
|
||||||
SetOutput(io.Writer)
|
SetOutput(io.Writer)
|
||||||
SetLevel(log.Lvl)
|
SetLevel(log.Lvl)
|
||||||
Color() *color.Color
|
|
||||||
Print(...interface{})
|
Print(...interface{})
|
||||||
Printf(string, ...interface{})
|
Printf(string, ...interface{})
|
||||||
Printj(log.JSON)
|
Printj(log.JSON)
|
||||||
|
@ -74,7 +74,7 @@ func RecoverWithConfig(config RecoverConfig) echo.MiddlewareFunc {
|
|||||||
stack := make([]byte, config.StackSize)
|
stack := make([]byte, config.StackSize)
|
||||||
length := runtime.Stack(stack, !config.DisableStackAll)
|
length := runtime.Stack(stack, !config.DisableStackAll)
|
||||||
if !config.DisablePrintStack {
|
if !config.DisablePrintStack {
|
||||||
c.Logger().Printf("[%s] %s %s", color.Red("PANIC RECOVER"), err, stack[:length])
|
c.Logger().Printf("[%s] %s %s\n", color.Red("PANIC RECOVER"), err, stack[:length])
|
||||||
}
|
}
|
||||||
c.Error(err)
|
c.Error(err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user