1
0
mirror of https://github.com/labstack/echo.git synced 2025-03-19 21:17:58 +02:00

Updated godoc

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-03-22 22:56:29 -05:00
parent f091ccc9fc
commit 910315ec5f
4 changed files with 20 additions and 19 deletions

10
glide.lock generated
View File

@ -1,5 +1,5 @@
hash: f220137e9ccd9aaf3051be33c3c23ea8abd2c40df6cf96175c3994d482b5e007
updated: 2016-03-18T16:35:06.621226469-07:00
hash: e740b7b4143d21e271e337a73d785c7c17a3c7ae1c775b7513287bb1599f3f0a
updated: 2016-03-21T18:17:41.019872464-07:00
imports:
- name: github.com/klauspost/compress
version: 006acde2c5d283d2f8b8aa03d8f0cd2891c680cf
@ -12,7 +12,7 @@ imports:
- name: github.com/klauspost/crc32
version: 19b0b332c9e4516a6370a0456e6182c3b5036720
- name: github.com/labstack/gommon
version: 81aef43cee03d40e9190983caeb70343a68d7f76
version: f4ba73f8bcf88df1524069c117f7878cf530ee4e
subpackages:
- color
- log
@ -21,11 +21,11 @@ imports:
- name: github.com/mattn/go-isatty
version: 56b76bdf51f7708750eac80fa38b952bb9f32639
- name: github.com/valyala/fasthttp
version: 2b172da53920a126cfc2532eced9400864bdacd9
version: 9ad70994bbadd681cb168849344df71aa045c70e
- name: github.com/valyala/fasttemplate
version: 3b874956e03f1636d171bda64b130f9135f42cff
- name: golang.org/x/net
version: 35b06af0720201bc2f326773a80767387544f8c4
version: 4d06dbdaa62241ec06ba6df63434548fb09c0099
subpackages:
- context
- websocket

View File

@ -18,9 +18,8 @@ type (
// LoggerConfig defines config for logger middleware.
//
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:
// - time_rfc3339
// - remote_ip
@ -30,10 +29,12 @@ type (
// - status
// - response_time
// - response_size
Format string
//
// Example "${remote_id} ${status}"
Format string // Required
// Output is the writer where logs are written. Default is `os.Stdout`.
Output io.Writer
// Output is the writer where logs are written.
Output io.Writer // Required
template *fasttemplate.Template
color *color.Color
@ -44,7 +45,7 @@ var (
// DefaultLoggerConfig is the default logger middleware config.
DefaultLoggerConfig = LoggerConfig{
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(),
Output: os.Stdout,
}
@ -69,7 +70,7 @@ func LoggerFromConfig(config LoggerConfig) echo.MiddlewareFunc {
rq := c.Request()
rs := c.Response()
start := time.Now()
if err := next.Handle(c); err != nil {
if err = next.Handle(c); err != nil {
c.Error(err)
}
stop := time.Now()

View File

@ -14,11 +14,11 @@ type (
// StackSize is the stack size to be printed.
StackSize int
// StackAll is flag to format stack traces of all other goroutines into
// buffer after the trace for the current goroutine, or not. Default is true.
// StackAll is a flag to format stack traces of all other goroutines into
// buffer after the trace for the current goroutine, or not.
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
}
)

View File

@ -12,14 +12,14 @@ type (
// StaticConfig defines config for static middleware.
StaticConfig struct {
// 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.
// 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 bool `json:"browse"`
// Browse is a flag to list directory or not.
Browse bool `json:"browse"` // Optional
}
)