diff --git a/server.go b/server.go index 0e36e0689..9fa49dcc2 100644 --- a/server.go +++ b/server.go @@ -11,14 +11,13 @@ import ( "github.com/markbates/refresh/refresh/web" "github.com/markbates/sigtx" "github.com/pkg/errors" - "github.com/sirupsen/logrus" ) // Serve the application at the specified address/port and listen for OS // interrupt and kill signals and will attempt to stop the application // gracefully. This will also start the Worker process, unless WorkerOff is enabled. func (a *App) Serve(srvs ...servers.Server) error { - logrus.Infof("Starting application at %s", a.Options.Host) + a.Logger.Infof("Starting application at %s", a.Options.Host) if len(srvs) == 0 { if strings.HasPrefix(a.Options.Addr, "unix:") { @@ -38,23 +37,23 @@ func (a *App) Serve(srvs ...servers.Server) error { go func() { // gracefully shut down the application when the context is cancelled <-ctx.Done() - logrus.Info("Shutting down application") + a.Logger.Info("Shutting down application") if err := a.Stop(ctx.Err()); err != nil { - logrus.Error(err) + a.Logger.Error(err) } if !a.WorkerOff { // stop the workers - logrus.Info("Shutting down worker") + a.Logger.Info("Shutting down worker") if err := a.Worker.Stop(); err != nil { - logrus.Error(err) + a.Logger.Error(err) } } for _, s := range srvs { if err := s.Shutdown(ctx); err != nil { - logrus.Error(err) + a.Logger.Error(err) } } @@ -86,7 +85,7 @@ func (a *App) Serve(srvs ...servers.Server) error { func (a *App) Stop(err error) error { a.cancel() if err != nil && errors.Cause(err) != context.Canceled { - logrus.Error(err) + a.Logger.Error(err) return err } return nil