1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-05-09 19:13:02 -07:00
parent e943ed24be
commit ef1d00349e
4 changed files with 22 additions and 5 deletions

View File

@ -47,9 +47,17 @@ type (
// Header returns `engine.Header`.
Header() Header
// Proto() string
// ProtoMajor() int
// ProtoMinor() int
// Referer returns the referring URL, if sent in the request.
Referer() string
// Protocol returns the protocol version string of the HTTP request.
// Protocol() string
// ProtocolMajor returns the major protocol version of the HTTP request.
// ProtocolMajor() int
// ProtocolMinor returns the minor protocol version of the HTTP request.
// ProtocolMinor() int
// ContentLength returns the size of request's body.
ContentLength() int

View File

@ -58,6 +58,11 @@ func (r *Request) Header() engine.Header {
return r.header
}
// Referer implements `engine.Request#Referer` function.
func (r *Request) Referer() string {
return r.Referer()
}
// ContentLength implements `engine.Request#ContentLength` function.
func (r *Request) ContentLength() int {
return r.Request.Header.ContentLength()

View File

@ -64,6 +64,11 @@ func (r *Request) Header() engine.Header {
return r.header
}
// Referer implements `engine.Request#Referer` function.
func (r *Request) Referer() string {
return r.Request.Referer()
}
// func Proto() string {
// return r.request.Proto()
// }

View File

@ -48,8 +48,7 @@ type (
var (
// DefaultLoggerConfig is the default logger middleware config.
DefaultLoggerConfig = LoggerConfig{
Format: "time=${time_rfc3339}, remote_ip=${remote_ip}, method=${method}, " +
"uri=${uri}, status=${status}, took=${response_time}, sent=${response_size} bytes\n",
Format: `{"time": "${time_rfc3339}", "remote_ip": "${remote_ip}", "method": "${method}", "uri": "${uri}", "status": ${status}, "took": "${response_time}", "sent": "${response_size}B"}`,
color: color.New(),
Output: os.Stdout,
}