From 8685e039a43a5203c28bf8fc8bf5065157d8b02d Mon Sep 17 00:00:00 2001 From: whwyy Date: Wed, 13 Dec 2023 18:19:36 +0800 Subject: [PATCH] eee --- Command.php | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/Command.php b/Command.php index 7eb4222..4fc7d52 100644 --- a/Command.php +++ b/Command.php @@ -131,7 +131,9 @@ class Command extends Component } catch (Throwable $throwable) { if ($this->isRefresh($throwable)) return $this->search($method); - return $this->println($throwable)->failure($throwable->getMessage(), 'mysql'); + $errorMsg = $this->sql . '.' . json_encode($this->params) . PHP_EOL . $throwable->getMessage(); + + return $this->getLogger()->failure($errorMsg, 'mysql'); } finally { $this->connection->release($client); } @@ -170,26 +172,15 @@ class Command extends Component } catch (Throwable $throwable) { if ($this->isRefresh($throwable)) return $this->_prepare(); - return $this->println($throwable)->failure($throwable->getMessage(), 'mysql'); + $errorMsg = $this->sql . '.' . json_encode($this->params) . PHP_EOL . $throwable->getMessage(); + + return $this->getLogger()->failure($errorMsg, 'mysql'); } finally { $this->connection->release($client); } } - /** - * @param Throwable $throwable - * @return StdoutLogger - */ - protected function println(Throwable $throwable): StdoutLogger - { - $logger = $this->getLogger(); - $error = $this->sql . '.' . json_encode($this->params) . PHP_EOL . throwable($throwable); - file_put_contents('php://output', '[' . date('Y-m-d H:i:s') . '] ' . $error, FILE_APPEND); - return $logger; - } - - /** * @param Throwable $throwable * @return bool