mirror of
https://github.com/labstack/echo.git
synced 2025-06-10 23:57:28 +02:00
Updated godoc
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
f091ccc9fc
commit
910315ec5f
10
glide.lock
generated
10
glide.lock
generated
@ -1,5 +1,5 @@
|
|||||||
hash: f220137e9ccd9aaf3051be33c3c23ea8abd2c40df6cf96175c3994d482b5e007
|
hash: e740b7b4143d21e271e337a73d785c7c17a3c7ae1c775b7513287bb1599f3f0a
|
||||||
updated: 2016-03-18T16:35:06.621226469-07:00
|
updated: 2016-03-21T18:17:41.019872464-07:00
|
||||||
imports:
|
imports:
|
||||||
- name: github.com/klauspost/compress
|
- name: github.com/klauspost/compress
|
||||||
version: 006acde2c5d283d2f8b8aa03d8f0cd2891c680cf
|
version: 006acde2c5d283d2f8b8aa03d8f0cd2891c680cf
|
||||||
@ -12,7 +12,7 @@ imports:
|
|||||||
- name: github.com/klauspost/crc32
|
- name: github.com/klauspost/crc32
|
||||||
version: 19b0b332c9e4516a6370a0456e6182c3b5036720
|
version: 19b0b332c9e4516a6370a0456e6182c3b5036720
|
||||||
- name: github.com/labstack/gommon
|
- name: github.com/labstack/gommon
|
||||||
version: 81aef43cee03d40e9190983caeb70343a68d7f76
|
version: f4ba73f8bcf88df1524069c117f7878cf530ee4e
|
||||||
subpackages:
|
subpackages:
|
||||||
- color
|
- color
|
||||||
- log
|
- log
|
||||||
@ -21,11 +21,11 @@ imports:
|
|||||||
- name: github.com/mattn/go-isatty
|
- name: github.com/mattn/go-isatty
|
||||||
version: 56b76bdf51f7708750eac80fa38b952bb9f32639
|
version: 56b76bdf51f7708750eac80fa38b952bb9f32639
|
||||||
- name: github.com/valyala/fasthttp
|
- name: github.com/valyala/fasthttp
|
||||||
version: 2b172da53920a126cfc2532eced9400864bdacd9
|
version: 9ad70994bbadd681cb168849344df71aa045c70e
|
||||||
- name: github.com/valyala/fasttemplate
|
- name: github.com/valyala/fasttemplate
|
||||||
version: 3b874956e03f1636d171bda64b130f9135f42cff
|
version: 3b874956e03f1636d171bda64b130f9135f42cff
|
||||||
- name: golang.org/x/net
|
- name: golang.org/x/net
|
||||||
version: 35b06af0720201bc2f326773a80767387544f8c4
|
version: 4d06dbdaa62241ec06ba6df63434548fb09c0099
|
||||||
subpackages:
|
subpackages:
|
||||||
- context
|
- context
|
||||||
- websocket
|
- websocket
|
||||||
|
@ -18,9 +18,8 @@ type (
|
|||||||
// LoggerConfig defines config for logger middleware.
|
// LoggerConfig defines config for logger middleware.
|
||||||
//
|
//
|
||||||
LoggerConfig struct {
|
LoggerConfig struct {
|
||||||
// Format is the log format.
|
// Format is the log format which can be constructed using the following tags:
|
||||||
//
|
//
|
||||||
// Example "${remote_id} ${status}"
|
|
||||||
// Available tags:
|
// Available tags:
|
||||||
// - time_rfc3339
|
// - time_rfc3339
|
||||||
// - remote_ip
|
// - remote_ip
|
||||||
@ -30,10 +29,12 @@ type (
|
|||||||
// - status
|
// - status
|
||||||
// - response_time
|
// - response_time
|
||||||
// - response_size
|
// - response_size
|
||||||
Format string
|
//
|
||||||
|
// Example "${remote_id} ${status}"
|
||||||
|
Format string // Required
|
||||||
|
|
||||||
// Output is the writer where logs are written. Default is `os.Stdout`.
|
// Output is the writer where logs are written.
|
||||||
Output io.Writer
|
Output io.Writer // Required
|
||||||
|
|
||||||
template *fasttemplate.Template
|
template *fasttemplate.Template
|
||||||
color *color.Color
|
color *color.Color
|
||||||
@ -44,7 +45,7 @@ var (
|
|||||||
// DefaultLoggerConfig is the default logger middleware config.
|
// DefaultLoggerConfig is the default logger middleware config.
|
||||||
DefaultLoggerConfig = LoggerConfig{
|
DefaultLoggerConfig = LoggerConfig{
|
||||||
Format: "time=${time_rfc3339}, remote_ip=${remote_ip}, method=${method}, " +
|
Format: "time=${time_rfc3339}, remote_ip=${remote_ip}, method=${method}, " +
|
||||||
"path=${path}, status=${status}, took=${response_time}, sent=t=${response_size} bytes\n",
|
"uri=${uri}, status=${status}, took=${response_time}, sent=${response_size} bytes\n",
|
||||||
color: color.New(),
|
color: color.New(),
|
||||||
Output: os.Stdout,
|
Output: os.Stdout,
|
||||||
}
|
}
|
||||||
@ -69,7 +70,7 @@ func LoggerFromConfig(config LoggerConfig) echo.MiddlewareFunc {
|
|||||||
rq := c.Request()
|
rq := c.Request()
|
||||||
rs := c.Response()
|
rs := c.Response()
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
if err := next.Handle(c); err != nil {
|
if err = next.Handle(c); err != nil {
|
||||||
c.Error(err)
|
c.Error(err)
|
||||||
}
|
}
|
||||||
stop := time.Now()
|
stop := time.Now()
|
||||||
|
@ -14,11 +14,11 @@ type (
|
|||||||
// StackSize is the stack size to be printed.
|
// StackSize is the stack size to be printed.
|
||||||
StackSize int
|
StackSize int
|
||||||
|
|
||||||
// StackAll is flag to format stack traces of all other goroutines into
|
// StackAll is a flag to format stack traces of all other goroutines into
|
||||||
// buffer after the trace for the current goroutine, or not. Default is true.
|
// buffer after the trace for the current goroutine, or not.
|
||||||
StackAll bool
|
StackAll bool
|
||||||
|
|
||||||
// PrintStack is the flag to print stack or not. Default is true.
|
// PrintStack is a flag to print stack or not.
|
||||||
PrintStack bool
|
PrintStack bool
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -12,14 +12,14 @@ type (
|
|||||||
// StaticConfig defines config for static middleware.
|
// StaticConfig defines config for static middleware.
|
||||||
StaticConfig struct {
|
StaticConfig struct {
|
||||||
// Root is the directory from where the static content is served.
|
// Root is the directory from where the static content is served.
|
||||||
Root string `json:"root"`
|
Root string `json:"root"` // Required
|
||||||
|
|
||||||
// Index is the index file to be used while serving a directory.
|
// Index is the index file to be used while serving a directory.
|
||||||
// Default is `index.html`.
|
// Default is `index.html`.
|
||||||
Index string `json:"index"`
|
Index string `json:"index"` // Optional
|
||||||
|
|
||||||
// Browse is the flag to list directory or not. Default is false.
|
// Browse is a flag to list directory or not.
|
||||||
Browse bool `json:"browse"`
|
Browse bool `json:"browse"` // Optional
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user