1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 18:30:50 +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
// and waits instead for Shutdown to return.
if err = srv.Server.Serve(srv.ln); err != nil && err != http.ErrServerClosed {
log.Println(syscall.Getpid(), "Server.Serve() error:", err)
return err
}
log.Println(syscall.Getpid(), srv.ln.Addr(), "Listener closed.")
// wait for Shutdown to return
return <-srv.terminalChan
}