1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 16:30:55 +00:00

add shutdown log

This commit is contained in:
nuczzz 2019-01-18 19:50:22 +08:00
parent 313be996cd
commit e295c3c7c3

View File

@ -39,9 +39,11 @@ func (srv *Server) Serve() (err error) {
// immediately return ErrServerClosed. Make sure the program doesn't exit // immediately return ErrServerClosed. Make sure the program doesn't exit
// and waits instead for Shutdown to return. // and waits instead for Shutdown to return.
if err = srv.Server.Serve(srv.ln); err != nil && err != http.ErrServerClosed { if err = srv.Server.Serve(srv.ln); err != nil && err != http.ErrServerClosed {
log.Println(syscall.Getpid(), "Server.Serve() error:", err)
return err return err
} }
log.Println(syscall.Getpid(), srv.ln.Addr(), "Listener closed.")
// wait for Shutdown to return // wait for Shutdown to return
return <-srv.terminalChan return <-srv.terminalChan
} }