Former-commit-id: d4eebea0b5849c574e2ffd4b0bb36e4380b14111
This commit is contained in:
Gerasimos (Makis) Maropoulos 2020-04-29 05:50:29 +03:00
parent 2a4043a3c2
commit ac08f53ba0
4 changed files with 94 additions and 86 deletions

View File

@ -93,7 +93,6 @@ func registerSubdomains(app *iris.Application) {
func newApp() *iris.Application {
app := iris.New()
app.Logger().SetLevel("debug")
registerErrors(app)
registerGamesRoutes(app)

View File

@ -386,20 +386,10 @@ func (r *Route) Trace(w io.Writer) {
}
path := r.Tmpl().Src
if subdomain := r.Subdomain; subdomain != "" {
if path == "" {
path = "/"
}
if subdomain == "*." { // wildcard.
subdomain = "subdomain"
}
r.Description = fmt.Sprintf("%s", subdomain)
// path = fmt.Sprintf("%s %s", r.Subdomain, path)
}
// @method: @path
// space := strings.Repeat(" ", len(http.MethodConnect)-len(r.Method))
// s := fmt.Sprintf("%s: %s", pio.Rich(r.Method, color), path)
@ -408,10 +398,24 @@ func (r *Route) Trace(w io.Writer) {
// (@description)
description := r.Description
if description == "" && r.Method == MethodNone {
if description == "" {
if r.Method == MethodNone {
description = "offline"
}
if subdomain := r.Subdomain; subdomain != "" {
if subdomain == "*." { // wildcard.
subdomain = "subdomain"
}
if description == "offline" {
description += ", "
}
description += subdomain
}
}
if description != "" {
// s += fmt.Sprintf(" %s", pio.Rich(description, pio.Cyan, pio.Underline))
fmt.Fprint(w, " ")

4
go.mod
View File

@ -20,9 +20,9 @@ require (
github.com/iris-contrib/pongo2 v0.0.1
github.com/iris-contrib/schema v0.0.1
github.com/json-iterator/go v1.1.9
github.com/kataras/golog v0.0.12
github.com/kataras/golog v0.0.13
github.com/kataras/neffos v0.0.15
github.com/kataras/pio v0.0.5
github.com/kataras/pio v0.0.6
github.com/kataras/sitemap v0.0.5
github.com/klauspost/compress v1.10.5
github.com/mediocregopher/radix/v3 v3.5.0

13
iris.go
View File

@ -728,10 +728,13 @@ func (app *Application) Shutdown(ctx stdContext.Context) error {
// app.Logger().Errorf("%s: %s", typ, err)
// })
func (app *Application) Build() error {
rp := errgroup.New("Application Builder")
if app.builded {
return nil
}
start := time.Now()
app.builded = true // even if fails.
if !app.builded {
app.builded = true
rp := errgroup.New("Application Builder")
rp.Err(app.APIBuilder.GetReporter())
if app.defaultMode { // the app.I18n and app.View will be not available until Build.
@ -808,7 +811,9 @@ func (app *Application) Build() error {
// re-build of the router from outside can be done with
// app.RefreshRouter()
}
}
// if end := time.Since(start); end.Seconds() > 5 {
app.logger.Debugf("Application: build took %s", time.Since(start))
return errgroup.Check(rp)
}