@@ -145,10 +145,10 @@ func (app *App) Start() error {
145145 // Wait for all servers to be ready
146146 sig .Wait ()
147147 if sig .Intercepted () {
148- log .Infof (context . Background () , log .TagAppDef , "server intercepted" )
148+ log .Infof (app . ctx , log .TagAppDef , "server intercepted" )
149149 return util .FormatError (nil , "server intercepted" )
150150 }
151- log .Infof (context . Background () , log .TagAppDef , "ready to serve requests" )
151+ log .Infof (app . ctx , log .TagAppDef , "ready to serve requests" )
152152 sig .Close ()
153153 }
154154 return nil
@@ -162,15 +162,15 @@ func (app *App) WaitForShutdown() {
162162
163163 // Gracefully shut down all running servers
164164 for _ , svr := range app .Servers {
165- goutil .Go (context . Background () , func (ctx context.Context ) {
166- if err := svr .Shutdown (ctx ); err != nil {
165+ goutil .Go (app . ctx , func (ctx context.Context ) {
166+ if err := svr .Shutdown (context . Background () ); err != nil {
167167 log .Errorf (ctx , log .TagAppDef , "shutdown server failed: %v" , err )
168168 }
169169 })
170170 }
171171 app .wg .Wait ()
172172 app .C .Close ()
173- log .Infof (context . Background () , log .TagAppDef , "shutdown complete" )
173+ log .Infof (app . ctx , log .TagAppDef , "shutdown complete" )
174174}
175175
176176// Exiting returns whether the application is currently in the process of shutting down.
@@ -182,7 +182,7 @@ func (app *App) Exiting() bool {
182182// setting the exiting flag and cancelling the root context.
183183func (app * App ) ShutDown () {
184184 if app .exiting .CompareAndSwap (false , true ) {
185- log .Infof (context . Background () , log .TagAppDef , "shutting down" )
185+ log .Infof (app . ctx , log .TagAppDef , "shutting down" )
186186 app .cancel ()
187187 }
188188}
0 commit comments