This commit is contained in:
2023-08-14 21:09:44 +08:00
parent 8cce9e5a3e
commit 53c06f8fd7
6 changed files with 44 additions and 18 deletions
+11 -2
View File
@@ -6,10 +6,12 @@ use Closure;
use Exception;
use Kiri;
use Kiri\Abstracts\Component;
use Kiri\Di\Inject\Container;
use Kiri\Server\Contract\OnProcessInterface;
use Monolog\Logger;
use Psr\Log\LoggerInterface;
use ReflectionException;
use Swoole\Process;
use Kiri\Abstracts\Logger;
use Kiri\Server\ServerInterface;
use Kiri\Server\Events\OnServerBeforeStart;
@@ -17,6 +19,13 @@ class ProcessManager extends Component
{
/**
* @var Logger
*/
#[Container(LoggerInterface::class)]
public Logger $logger;
/** @var array<string, BaseProcess> */
private array $_process = [];
@@ -174,7 +183,7 @@ class ProcessManager extends Component
{
set_env('environmental', Kiri::PROCESS);
$system = sprintf('[%s].Custom Process', \config('id', 'system-service'));
Logger::_alert($system . ' ' . $custom->getName() . ' start.');
$this->logger->alert($system . ' ' . $custom->getName() . ' start.');
if (Kiri::getPlatform()->isLinux()) {
$process->name($system . '[' . $process->pid . '].' . $custom->getName());
}