diff options
author | Wolfy-J <[email protected]> | 2019-05-03 15:44:51 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2019-05-03 15:44:51 +0300 |
commit | 28c787d66c2b74dd2300c792abd1e4f987c3d6c9 (patch) | |
tree | b9c5ef036eda3ffa16b5e87a06ce99fcd8a4d7b4 /cmd/util/debug.go | |
parent | e9d42947a6922ce2f0aa9f9bcab4ead167735bc9 (diff) |
new watchers functionality
Diffstat (limited to 'cmd/util/debug.go')
-rw-r--r-- | cmd/util/debug.go | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/cmd/util/debug.go b/cmd/util/debug.go index f64b9bc4..54ef104f 100644 --- a/cmd/util/debug.go +++ b/cmd/util/debug.go @@ -3,6 +3,7 @@ package util import ( "github.com/sirupsen/logrus" "github.com/spiral/roadrunner" + "github.com/spiral/roadrunner/service/watcher" "strings" ) @@ -12,7 +13,7 @@ func LogEvent(logger *logrus.Logger, event int, ctx interface{}) bool { case roadrunner.EventWorkerKill: w := ctx.(*roadrunner.Worker) logger.Warning(Sprintf( - "<white+hb>worker.%v</reset> <yellow>killed</red>", + "<white+hb>worker.%v</reset> <yellow>killed</reset>", *w.Pid, )) return true @@ -57,5 +58,26 @@ func LogEvent(logger *logrus.Logger, event int, ctx interface{}) bool { return true } + // watchers + switch event { + case watcher.EventMaxTTL: + w := ctx.(roadrunner.WorkerError) + logger.Debug(Sprintf( + "<white+hb>worker.%v</reset> <yellow>%s</reset>", + *w.Worker.Pid, + w.Caused, + )) + return true + + case watcher.EventMaxMemory: + w := ctx.(roadrunner.WorkerError) + logger.Warning(Sprintf( + "<white+hb>worker.%v</reset> <red>%s</reset>", + *w.Worker.Pid, + w.Caused, + )) + return true + } + return false } |