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

logging: several improvements

Former-commit-id: 12538c74a1aa55314c35ac3cf2665646b704851d
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-04-28 01:58:56 +03:00
parent b02706f207
commit 27ca1c93f5
11 changed files with 125 additions and 56 deletions

View File

@@ -33,9 +33,9 @@ func newApp() *iris.Application {
}
func getHandler(ctx iris.Context) {
ctx.Writef("From %s", ctx.GetCurrentRoute().Trace())
ctx.Writef("From GET: %s", ctx.GetCurrentRoute().MainHandlerName())
}
func anyHandler(ctx iris.Context) {
ctx.Writef("From %s", ctx.GetCurrentRoute().Trace())
ctx.Writef("From %s: %s", ctx.Method(), ctx.GetCurrentRoute().MainHandlerName())
}

View File

@@ -14,9 +14,9 @@ func TestRouteRegisterRuleExample(t *testing.T) {
for _, method := range router.AllMethods {
tt := e.Request(method, "/").Expect().Status(httptest.StatusOK).Body()
if method == "GET" {
tt.Equal("From [./main.go:28] GET: / -> github.com/kataras/iris/v12/_examples/routing/route-register-rule.getHandler()")
tt.Equal("From GET: github.com/kataras/iris/v12/_examples/routing/route-register-rule.getHandler")
} else {
tt.Equal("From [./main.go:30] " + method + ": / -> github.com/kataras/iris/v12/_examples/routing/route-register-rule.anyHandler()")
tt.Equal("From " + method + ": github.com/kataras/iris/v12/_examples/routing/route-register-rule.anyHandler")
}
}
}