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
+12 -4
View File
@@ -4,9 +4,9 @@ namespace Kiri\Server\Abstracts;
use Exception;
use Kiri;
use Kiri\Abstracts\Logger;
use ReflectionException;
use Swoole\Coroutine;
use Kiri\Di\Inject\Container;
use Monolog\Logger;
use Psr\Log\LoggerInterface;
use Swoole\Http\Server as HServer;
use Swoole\Process;
use Swoole\Server;
@@ -21,6 +21,14 @@ trait TraitServer
private array $_process = [];
/**
* @var Logger
*/
#[Container(LoggerInterface::class)]
public Logger $logger;
/**
* @param string|array|BaseProcess $class
* @return void
@@ -87,7 +95,7 @@ trait TraitServer
public function onSigint($no, array $signInfo): void
{
try {
Logger::_alert('Pid ' . getmypid() . ' get signo ' . $no);
$this->logger->alert('Pid ' . getmypid() . ' get signo ' . $no);
$this->shutdown();
} catch (\Throwable $exception) {
error($exception);