diff --git a/Kiri.php b/Kiri.php index d1ece166..688c2933 100644 --- a/Kiri.php +++ b/Kiri.php @@ -10,6 +10,8 @@ use Kiri\Abstracts\Config; use Kiri\Di\Container; use Kiri\Di\LocalService; use Kiri\Environmental; +use Kiri\Error\StdoutLogger; +use Kiri\Error\StdoutLoggerInterface; use Kiri\Exception\ConfigException; use Psr\Log\LoggerInterface; use Swoole\Coroutine; @@ -74,7 +76,6 @@ class Kiri /** * @param $prefix * @return void - * @throws ConfigException */ public static function setProcessName($prefix): void { @@ -115,6 +116,7 @@ class Kiri /** * @return LocalService + * @throws ReflectionException */ public static function service(): LocalService { @@ -123,10 +125,10 @@ class Kiri /** - * @return LoggerInterface + * @return StdoutLogger * @throws ReflectionException */ - public static function getLogger(): LoggerInterface + public static function getLogger(): StdoutLogger { return static::getContainer()->get(LoggerInterface::class); } diff --git a/kiri-engine/Abstracts/BaseMain.php b/kiri-engine/Abstracts/BaseMain.php index 89b709d9..00d613f7 100644 --- a/kiri-engine/Abstracts/BaseMain.php +++ b/kiri-engine/Abstracts/BaseMain.php @@ -14,7 +14,7 @@ use Exception; use Kiri; use Kiri\Di\LocalService; use ReflectionException; -use Kiri\Error\{StdoutLogger, StdoutLoggerInterface}; +use Kiri\Error\StdoutLogger; use Kiri\Exception\{InitException}; use Psr\Log\LoggerInterface; use Kiri\Events\EventProvider; @@ -54,12 +54,12 @@ abstract class BaseMain extends Component /** * @param array $mapping * @param array $components + * @throws ReflectionException */ public function mapping(array $mapping, array $components) { $di = Kiri::getDi(); - $di->set(StdoutLoggerInterface::class, StdoutLogger::class); - $di->set(LoggerInterface::class, Logger::class); + $di->set(LoggerInterface::class, StdoutLogger::class); foreach ($mapping as $interface => $class) { $di->set($interface, $class); } diff --git a/kiri-engine/Abstracts/Logger.php b/kiri-engine/Abstracts/Logger.php index c0576b4b..6f6aa9bd 100644 --- a/kiri-engine/Abstracts/Logger.php +++ b/kiri-engine/Abstracts/Logger.php @@ -34,7 +34,6 @@ class Logger implements LoggerInterface /** * @param string $message * @param array $context - * @throws ConfigException * * 紧急情况 */ @@ -48,7 +47,6 @@ class Logger implements LoggerInterface /** * @param string $message * @param array $context - * @throws ConfigException * * 应该警惕的 */ @@ -62,7 +60,6 @@ class Logger implements LoggerInterface /** * @param string $message * @param array $context - * @throws ConfigException * * 关键性的日志 */ @@ -76,7 +73,6 @@ class Logger implements LoggerInterface /** * @param string $message * @param array $context - * @throws ConfigException */ public function error($message, array $context = []) { @@ -88,7 +84,6 @@ class Logger implements LoggerInterface /** * @param string $message * @param array $context - * @throws ConfigException */ public function warning($message, array $context = []) { @@ -99,7 +94,6 @@ class Logger implements LoggerInterface /** * @param string $message * @param array $context - * @throws ConfigException */ public function notice($message, array $context = []) { @@ -111,7 +105,6 @@ class Logger implements LoggerInterface /** * @param string $message * @param array $context - * @throws ConfigException */ public function info($message, array $context = []) { @@ -123,7 +116,6 @@ class Logger implements LoggerInterface /** * @param string $message * @param array $context - * @throws ConfigException */ public function debug($message, array $context = []) { @@ -136,8 +128,7 @@ class Logger implements LoggerInterface * @param mixed $level * @param string $message * @param array $context - * @throws ConfigException - * @throws Exception + * @throws */ public function log($level, $message, array $context = []) { diff --git a/kiri-engine/Error/StdoutLogger.php b/kiri-engine/Error/StdoutLogger.php index 206c190e..2bd9732a 100644 --- a/kiri-engine/Error/StdoutLogger.php +++ b/kiri-engine/Error/StdoutLogger.php @@ -5,9 +5,8 @@ declare(strict_types=1); namespace Kiri\Error; use Kiri\Abstracts\Logger; -use Kiri\Exception\ConfigException; -class StdoutLogger extends Logger implements StdoutLoggerInterface +class StdoutLogger extends Logger { @@ -21,7 +20,6 @@ class StdoutLogger extends Logger implements StdoutLoggerInterface * @param $message * @param string $model * @return bool - * @throws ConfigException */ public function addError($message, string $model = 'app'): bool { diff --git a/kiri-engine/Error/StdoutLoggerInterface.php b/kiri-engine/Error/StdoutLoggerInterface.php deleted file mode 100644 index 067db663..00000000 --- a/kiri-engine/Error/StdoutLoggerInterface.php +++ /dev/null @@ -1,26 +0,0 @@ -