From e69990797098d422c2fc0dd54df9c0db510eb2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Wed, 12 Jan 2022 11:32:36 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E6=94=B9=E5=90=8D"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit fdf58326 --- ProcessManager.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ProcessManager.php b/ProcessManager.php index f9fb2d6..6a5bc42 100644 --- a/ProcessManager.php +++ b/ProcessManager.php @@ -3,12 +3,14 @@ namespace Kiri\Server; use Kiri\Abstracts\Config; +use Kiri\Annotation\Inject; use Kiri\Context; use Kiri\Exception\ConfigException; use Kiri\Kiri; use Kiri\Server\Abstracts\BaseProcess; use Kiri\Server\Broadcast\Message; use Kiri\Server\Contract\OnProcessInterface; +use Psr\Log\LoggerInterface; use Swoole\Coroutine; use Swoole\Process; @@ -20,6 +22,9 @@ class ProcessManager private array $_process = []; + #[Inject(LoggerInterface::class)] + public LoggerInterface $logger; + /** * @param string|OnProcessInterface|BaseProcess $customProcess * @return void @@ -31,8 +36,11 @@ class ProcessManager if (is_string($customProcess)) { $customProcess = Kiri::getDi()->get($customProcess); } + $system = sprintf('[%s].process', Config::get('id', 'system-service')); - $server->logger->debug($system . ' ' . $customProcess->getName() . ' start.'); + + $this->logger->debug($system . ' ' . $customProcess->getName() . ' start.'); + $server->addProcess($process = $this->parse($customProcess, $system)); $this->_process[$customProcess->getName()] = $process; }