1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-09 13:05:56 +00:00

create the new FileServer and HandleDir, deprecate the rest APIBuilder/Party static methods and more

relative: https://github.com/kataras/iris/issues/1283 and removing pongo2 from vendor: https://github.com/kataras/iris/issues/1284

Former-commit-id: 3ec57b349f99faca2b8e36d9f7252db0b6ea080d
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-06-21 19:43:25 +03:00
parent 7f9e33cabb
commit d0104defa8
72 changed files with 1585 additions and 1826 deletions

View File

@@ -68,7 +68,10 @@ type Config struct {
// LogFunc is the writer which logs are written to,
// if missing the logger middleware uses the app.Logger().Infof instead.
// Note that message argument can be empty.
LogFunc func(now time.Time, latency time.Duration, status, ip, method, path string, message interface{}, headerMessage interface{})
LogFunc func(endTime time.Time, latency time.Duration, status, ip, method, path string, message interface{}, headerMessage interface{})
// LogFuncCtx can be used instead of `LogFunc` if handlers need to customize the output based on
// custom request-time information that the LogFunc isn't aware of.
LogFuncCtx func(ctx context.Context, latency time.Duration)
// Skippers used to skip the logging i.e by `ctx.Path()` and serve
// the next/main handler immediately.
Skippers []SkipperFunc
@@ -83,15 +86,16 @@ type Config struct {
// LogFunc and Skippers to nil as well.
func DefaultConfig() Config {
return Config{
Status: true,
IP: true,
Method: true,
Path: true,
Query: false,
Columns: false,
LogFunc: nil,
Skippers: nil,
skip: nil,
Status: true,
IP: true,
Method: true,
Path: true,
Query: false,
Columns: false,
LogFunc: nil,
LogFuncCtx: nil,
Skippers: nil,
skip: nil,
}
}

View File

@@ -100,6 +100,9 @@ func (l *requestLoggerMiddleware) ServeHTTP(ctx context.Context) {
if logFunc := l.config.LogFunc; logFunc != nil {
logFunc(endTime, latency, status, ip, method, path, message, headerMessage)
return
} else if logFuncCtx := l.config.LogFuncCtx; logFuncCtx != nil {
logFuncCtx(ctx, latency)
return
}
if l.config.Columns {