@@ -33,7 +33,8 @@ type ReloadInterface interface {
3333}
3434
3535type App struct {
36- apps []Application
36+ apps []Application
37+ debug bool
3738}
3839
3940var Instance * App
@@ -59,6 +60,14 @@ func (a *App) Register(applications ...Application) *App {
5960 a .apps = append (a .apps , applications ... )
6061 return a
6162}
63+ func (a * App ) Debug (v ... bool ) * App {
64+ if len (v ) > 0 {
65+ a .debug = v [0 ]
66+ } else {
67+ a .debug = true
68+ }
69+ return a
70+ }
6271
6372func (a * App ) Run () * App {
6473 //Sort applications by priority
@@ -67,6 +76,9 @@ func (a *App) Run() *App {
6776 })
6877
6978 for _ , app := range a .apps {
79+ if a .debug {
80+ log .Infof ("Registering application: %s %s.Router()" , app .Name (), reflect .TypeOf (app ).PkgPath ())
81+ }
7082 if err := app .Register (); err != nil {
7183 log .Fatalf ("Can't start application Register() %s: %v" , app .Name (), err )
7284 }
@@ -79,11 +91,17 @@ func (a *App) Run() *App {
7991 ref .Method (i ).Call ([]reflect.Value {})
8092 }
8193 }
94+ if a .debug {
95+ log .Infof ("Setting router for application: %s %s.Router()" , app .Name (), reflect .TypeOf (app ).PkgPath ())
96+ }
8297 if err := app .Router (); err != nil {
8398 log .Fatalf ("Can't start application Router() %s: %v" , app .Name (), err )
8499 }
85100 }
86101 for _ , app := range a .apps {
102+ if a .debug {
103+ log .Infof ("WhenReady application: %s %s.WhenReady()" , app .Name (), reflect .TypeOf (app ).PkgPath ())
104+ }
87105 if err := app .WhenReady (); err != nil {
88106 log .Fatalf ("Can't start application WhenReady() %s: %v" , app .Name (), err )
89107 }
0 commit comments