application shutdown - How to log messages for signaltype in Tylerb Graceful in go? -
i have been looking go programming couple of days now. have been looking way of gracefully shutting down go app. app serves http request , should complete outstanding requests before exiting. using tylerb graceful.
https://github.com/tylerb/graceful
my question is:
how can log message captures type of signal? eg. interrupted, terminated or sigkill, sigterm, sigint
so far thing have been able implement simple message telling exited gracefully, if sigkill it, there no message being logged:
mux := // ... srv := &graceful.server{ timeout: 10 * time.second, server: &http.server{ addr: ":1234", handler: mux, }, } srv.listenandserve() log.println("server stopped gracefully")
Comments
Post a Comment