1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-23 04:47:02 +00:00

accesslog: improvements

This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-09-10 19:41:30 +03:00
parent bfb7b19096
commit facc94b725
5 changed files with 170 additions and 32 deletions

View File

@@ -1,6 +1,8 @@
package main
import (
"os"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/middleware/accesslog"
"github.com/kataras/iris/v12/middleware/recover"
@@ -16,6 +18,8 @@ func main() {
*/
ac := accesslog.File("./access.log")
ac.AddOutput(os.Stdout)
ac.TimeFormat = "2006-01-02 15:04:05"
// ac.KeepMultiLineError = false // set to false to print errors as one line.
// Optionally run logging after response has sent:
@@ -43,7 +47,7 @@ func main() {
}
func notFoundHandler(ctx iris.Context) {
ctx.Application().Logger().Infof("Not Found Handler for: %s", ctx.Path())
// ctx.Application().Logger().Infof("Not Found Handler for: %s", ctx.Path())
suggestPaths := ctx.FindClosest(3)
if len(suggestPaths) == 0 {