From 919e6fc6596eff2abcde4d532bd08ac5dc9972cb Mon Sep 17 00:00:00 2001 From: bakape Date: Sun, 7 May 2017 02:58:15 +0300 Subject: [PATCH] Log server start and address Useful, when port or host is not the default or knowing, when the server started, with chained comands like `go build && ./nyaa`. --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index e2ce0e97..c62bfdde 100644 --- a/main.go +++ b/main.go @@ -19,11 +19,13 @@ func RunServer(conf *config.Config) { http.Handle("/", router.Router) // Set up server, + addr := fmt.Sprintf("%s:%d", conf.Host, conf.Port) srv := &http.Server{ - Addr: fmt.Sprintf("%s:%d", conf.Host, conf.Port), + Addr: addr, WriteTimeout: 15 * time.Second, ReadTimeout: 15 * time.Second, } + log.Infof("listening on %s", addr) err := srv.ListenAndServe() log.CheckError(err) @@ -47,4 +49,4 @@ func main() { db.ORM, _ = db.GormInit(conf) RunServer(conf) } -} \ No newline at end of file +}