变更
This commit is contained in:
@@ -124,6 +124,7 @@ class Kiri
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return LoggerInterface
|
* @return LoggerInterface
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function getLogger(): LoggerInterface
|
public static function getLogger(): LoggerInterface
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ class Component implements Configure
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
protected ?StdoutLoggerInterface $logger = null;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseAbstract constructor.
|
* BaseAbstract constructor.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ class ErrorHandler extends Component implements ErrorInterface
|
|||||||
|
|
||||||
$data = Json::jsonFail($error[1], 500, $path);
|
$data = Json::jsonFail($error[1], 500, $path);
|
||||||
|
|
||||||
$this->logger->error('On error handler', [$data]);
|
\Kiri::getLogger()->error('On error handler', [$data]);
|
||||||
|
|
||||||
$this->dispatch->dispatch(new Kiri\Events\OnSystemError());
|
$this->dispatch->dispatch(new Kiri\Events\OnSystemError());
|
||||||
|
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ class Connection extends Component
|
|||||||
$result = true;
|
$result = true;
|
||||||
}
|
}
|
||||||
} catch (Error|Throwable $exception) {
|
} catch (Error|Throwable $exception) {
|
||||||
$result = $this->logger->addError($exception, 'mysql');
|
$result = \Kiri::getLogger()->addError($exception, 'mysql');
|
||||||
} finally {
|
} finally {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ SCRIPT;
|
|||||||
try {
|
try {
|
||||||
$response = $client->{$name}(...$arguments);
|
$response = $client->{$name}(...$arguments);
|
||||||
} catch (\Throwable $throwable) {
|
} catch (\Throwable $throwable) {
|
||||||
$response = $this->logger->addError($throwable->getMessage());
|
$response = \Kiri::getLogger()->addError($throwable->getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
$pool = $this->container->get(Pool::class);
|
$pool = $this->container->get(Pool::class);
|
||||||
$pool->push($this->host, $client);
|
$pool->push($this->host, $client);
|
||||||
|
|||||||
Reference in New Issue
Block a user