1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-22 04:17:03 +00:00

add accesslog middleware (rel: #1601)

This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-09-06 10:38:48 +03:00
parent bf9f7617e2
commit 0be856e54c
16 changed files with 339 additions and 347 deletions

View File

@@ -48,20 +48,11 @@ type Config struct {
// Defaults to false.
TraceRoute bool
// Columns will display the logs as a formatted columns-rows text (bool).
// If custom `LogFunc` has been provided then this field is useless and users should
// use the `Columinize` function of the logger to get the output result as columns.
//
// Defaults to false.
Columns bool
// MessageContextKeys if not empty,
// the middleware will try to fetch
// the contents with `ctx.Values().Get(MessageContextKey)`
// and if available then these contents will be
// appended as part of the logs (with `%v`, in order to be able to set a struct too),
// if Columns field was set to true then
// a new column will be added named 'Message'.
//
// Defaults to empty.
MessageContextKeys []string
@@ -71,8 +62,6 @@ type Config struct {
// the contents with `ctx.Values().Get(MessageHeaderKey)`
// and if available then these contents will be
// appended as part of the logs (with `%v`, in order to be able to set a struct too),
// if Columns field was set to true then
// a new column will be added named 'HeaderMessage'.
//
// Defaults to empty.
MessageHeaderKeys []string
@@ -93,7 +82,7 @@ type Config struct {
}
// DefaultConfig returns a default config
// that have all boolean fields to true except `Columns`,
// that have all boolean fields to true,
// all strings are empty,
// LogFunc and Skippers to nil as well.
func DefaultConfig() Config {
@@ -105,7 +94,6 @@ func DefaultConfig() Config {
PathAfterHandler: false,
Query: false,
TraceRoute: false,
Columns: false,
LogFunc: nil,
LogFuncCtx: nil,
Skippers: nil,