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

Update to 8.1.0 - a new logger implemented as a solution for https://github.com/kataras/iris/issues/680

Former-commit-id: 765b43602655fad7f525ca7a5f7f297a6167d075
This commit is contained in:
kataras
2017-07-26 15:30:20 +03:00
parent 726d89fd1b
commit 345e7280a1
14 changed files with 78 additions and 50 deletions

View File

@@ -79,14 +79,15 @@ func (l *requestLoggerMiddleware) ServeHTTP(ctx context.Context) {
logFunc(endTime, latency, status, ip, method, path, message)
return
}
endTimeFormatted := endTime.Format("2006/01/02 - 15:04:05")
if l.config.Columns {
endTimeFormatted := endTime.Format("2006/01/02 - 15:04:05")
output := Columnize(endTimeFormatted, latency, status, ip, method, path, message)
ctx.Application().Logger().Out.Write([]byte(output))
ctx.Application().Logger().Printer.Output.Write([]byte(output))
return
}
// no new line, the framework's logger is responsible how to render each log.
line := fmt.Sprintf("%s | %v %4v %s %s %s", endTimeFormatted, status, latency, ip, method, path)
line := fmt.Sprintf("%v %4v %s %s %s", status, latency, ip, method, path)
if message != nil {
line += fmt.Sprintf(" %v", message)
}