diff --git a/kiri-engine/Abstracts/BaseApplication.php b/kiri-engine/Abstracts/BaseApplication.php index d457ca16..602c66b6 100644 --- a/kiri-engine/Abstracts/BaseApplication.php +++ b/kiri-engine/Abstracts/BaseApplication.php @@ -10,23 +10,18 @@ declare(strict_types=1); namespace Kiri\Abstracts; -use Database\Connection; use Exception; -use Kafka\KafkaProvider; use Kiri; -use Kiri\Cache\Redis; use Kiri\Di\LocalService; use Kiri\Error\{ErrorHandler}; -use Kiri\Error\StdoutLogger; use Kiri\Error\StdoutLoggerInterface; +use Kiri\Error\StdoutLogger; use Kiri\Exception\{InitException, NotFindClassException}; -use Kiri\Message\Handler\Router; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Kiri\Server\{Server}; use Psr\Log\LoggerInterface; use ReflectionException; -use Swoole\Table; /** * Class BaseApplication diff --git a/kiri-engine/Abstracts/Component.php b/kiri-engine/Abstracts/Component.php index 1f26a286..4cdd4fe0 100644 --- a/kiri-engine/Abstracts/Component.php +++ b/kiri-engine/Abstracts/Component.php @@ -14,7 +14,7 @@ use Exception; use JetBrains\PhpStorm\Pure; use Kiri; use Kiri\Di\Container; -use Kiri\Error\StdoutLogger; +use Kiri\Error\StdoutLoggerInterface; use Kiri\Events\EventDispatch; use Kiri\Events\EventProvider; use Psr\Container\ContainerExceptionInterface; @@ -32,7 +32,7 @@ class Component implements Configure { - protected ?StdoutLogger $logger = null; + protected ?StdoutLoggerInterface $logger = null; /** @@ -44,7 +44,7 @@ class Component implements Configure public function __construct(array $config = []) { if (is_null($this->logger)) { - $this->logger = Kiri::getDi()->get(StdoutLogger::class); + $this->logger = Kiri::getDi()->get(StdoutLoggerInterface::class); } if (!empty($config) && is_array($config)) { Kiri::configure($this, $config); diff --git a/kiri-engine/FileListen/HotReload.php b/kiri-engine/FileListen/HotReload.php index c92f541e..5d2a509a 100644 --- a/kiri-engine/FileListen/HotReload.php +++ b/kiri-engine/FileListen/HotReload.php @@ -7,11 +7,11 @@ use Kiri; use Kiri\Abstracts\Config; use Kiri\Annotation\Inject; use Kiri\Core\Json; +use Kiri\Error\StdoutLoggerInterface; use Kiri\Exception\ConfigException; use Swoole\Coroutine; use Swoole\Process; use Swoole\Timer; -use Kiri\Error\StdoutLogger; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -39,8 +39,8 @@ class HotReload extends Command public Inotify|Scaner $driver; - #[Inject(StdoutLogger::class)] - public StdoutLogger $logger; + #[Inject(StdoutLoggerInterface::class)] + public StdoutLoggerInterface $logger; protected mixed $source = NULL; @@ -117,7 +117,7 @@ class HotReload extends Command } $data = Json::to(500, $error[1], $path); - $this->logger->error($data, 'error'); + $this->logger->error('error', [$data]); } diff --git a/kiri-engine/FileListen/Inotify.php b/kiri-engine/FileListen/Inotify.php index b7d719f4..7ba48c72 100644 --- a/kiri-engine/FileListen/Inotify.php +++ b/kiri-engine/FileListen/Inotify.php @@ -3,7 +3,7 @@ namespace Kiri\FileListen; use Exception; -use Kiri\Error\StdoutLogger; +use Kiri\Error\StdoutLoggerInterface; use Swoole\Event; use Swoole\Timer; @@ -103,7 +103,7 @@ class Inotify */ public function reload($path) { - \Kiri::getDi()->get(StdoutLogger::class)->warning('file change'); + \Kiri::getDi()->get(StdoutLoggerInterface::class)->warning('file change'); $this->process->trigger_reload($path); $this->process->int = -1; diff --git a/kiri-engine/FileListen/Scaner.php b/kiri-engine/FileListen/Scaner.php index 208720a3..0fab051a 100644 --- a/kiri-engine/FileListen/Scaner.php +++ b/kiri-engine/FileListen/Scaner.php @@ -3,7 +3,7 @@ namespace Kiri\FileListen; use Exception; -use Kiri\Error\StdoutLogger; +use Kiri\Error\StdoutLoggerInterface; class Scaner { @@ -113,7 +113,7 @@ class Scaner { $this->isReloading = TRUE; - \Kiri::getDi()->get(StdoutLogger::class)->warning('file change'); + \Kiri::getDi()->get(StdoutLoggerInterface::class)->warning('file change'); $this->process->trigger_reload($path);