diff --git a/server.go b/server.go index 17e21321c..d225904b9 100644 --- a/server.go +++ b/server.go @@ -22,9 +22,7 @@ import ( func (a *App) Serve(srvs ...servers.Server) error { var wg sync.WaitGroup - // FIXME: this information is not correct. - // It needs to be fixed as we support multiple servers. - a.Logger.Infof("starting application at http://%s", a.Options.Addr) + a.Logger.Debug("starting application") payload := events.Payload{ "app": a, @@ -98,6 +96,7 @@ func (a *App) Serve(srvs ...servers.Server) error { for _, s := range srvs { s.SetAddr(a.Addr) + a.Logger.Infof("starting %s", s) wg.Add(1) go func(s servers.Server) { defer wg.Done() diff --git a/servers/listener.go b/servers/listener.go index b36f8895c..e0f985d76 100644 --- a/servers/listener.go +++ b/servers/listener.go @@ -2,6 +2,7 @@ package servers import ( "context" + "fmt" "net" "net/http" ) @@ -19,6 +20,11 @@ func (s *Listener) SetAddr(addr string) { } } +// String returns a string representation of a Listener +func (s *Listener) String() string { + return fmt.Sprintf("listener on %s", s.Server.Addr) +} + // Start the server func (s *Listener) Start(c context.Context, h http.Handler) error { s.Handler = h diff --git a/servers/simple.go b/servers/simple.go index b0e30d0d1..61891e441 100644 --- a/servers/simple.go +++ b/servers/simple.go @@ -2,6 +2,7 @@ package servers import ( "context" + "fmt" "net/http" ) @@ -17,6 +18,11 @@ func (s *Simple) SetAddr(addr string) { } } +// String returns a string representation of a Simple server +func (s *Simple) String() string { + return fmt.Sprintf("simple server on %s", s.Server.Addr) +} + // Start the server func (s *Simple) Start(c context.Context, h http.Handler) error { s.Handler = h diff --git a/servers/tls.go b/servers/tls.go index 826eaa748..8e5f837b7 100644 --- a/servers/tls.go +++ b/servers/tls.go @@ -2,6 +2,7 @@ package servers import ( "context" + "fmt" "net/http" ) @@ -19,6 +20,11 @@ func (s *TLS) SetAddr(addr string) { } } +// String returns a string representation of a Listener +func (s *TLS) String() string { + return fmt.Sprintf("TLS server on %s", s.Server.Addr) +} + // Start the server func (s *TLS) Start(c context.Context, h http.Handler) error { s.Handler = h