diff options
Diffstat (limited to 'http/service.go')
-rw-r--r-- | http/service.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/http/service.go b/http/service.go index 554b79e3..f8e05f4d 100644 --- a/http/service.go +++ b/http/service.go @@ -5,6 +5,7 @@ import ( "github.com/sirupsen/logrus" "github.com/spiral/roadrunner/service" "net/http" + "github.com/spiral/roadrunner" ) type Service struct { @@ -49,6 +50,21 @@ func (s *Service) Serve() error { } defer term() + rr.Observe(func(event int, ctx interface{}) { + switch event { + case roadrunner.EventPoolError: + logrus.Error(ctx) + case roadrunner.EventWorkerCreate: + logrus.Infof("%s - created", ctx) + case roadrunner.EventWorkerError: + logrus.Errorf("%s: %s", ctx.(roadrunner.WorkerError).Worker, ctx.(roadrunner.WorkerError).Error()) + case roadrunner.EventWorkerDestruct: + logrus.Warnf("%s - destructed", ctx) + case roadrunner.EventWorkerKill: + logrus.Warnf("%s - killed", ctx) + } + }) + s.srv = NewServer(s.cfg.httpConfig(), rr) s.http = &http.Server{ Addr: s.cfg.httpAddr(), |