改名
This commit is contained in:
@@ -143,11 +143,11 @@ class ErrorHandler extends Component implements ErrorInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $message
|
* @param $message
|
||||||
* @param $category
|
* @param string $category
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function writer($message, $category = 'app')
|
public function writer($message, string $category = 'app')
|
||||||
{
|
{
|
||||||
Snowflake::app()->debug($message, $category);
|
Snowflake::app()->debug($message, $category);
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-27
@@ -48,7 +48,7 @@ class Logger extends Component
|
|||||||
*/
|
*/
|
||||||
public function debug(mixed $message, string $method = 'app', $file = null)
|
public function debug(mixed $message, string $method = 'app', $file = null)
|
||||||
{
|
{
|
||||||
$this->writer($message, $method);
|
$this->output($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ class Logger extends Component
|
|||||||
*/
|
*/
|
||||||
public function trance(mixed $message, string $method = 'app')
|
public function trance(mixed $message, string $method = 'app')
|
||||||
{
|
{
|
||||||
$this->writer($message, $method);
|
$this->output($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -82,35 +82,25 @@ class Logger extends Component
|
|||||||
*/
|
*/
|
||||||
public function success(mixed $message, string $method = 'app', $file = null)
|
public function success(mixed $message, string $method = 'app', $file = null)
|
||||||
{
|
{
|
||||||
$this->writer($message, $method);
|
$this->output($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $message
|
* @param $message
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @return string
|
* @return void
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function writer($message, string $method = 'app'): string
|
private function writer($message, string $method = 'app'): void
|
||||||
{
|
{
|
||||||
$this->print_r($message, $method);
|
$this->print_r($message, $method);
|
||||||
if ($message instanceof Throwable) {
|
$message = $this->arrayFormat($message);
|
||||||
$message = $message->getMessage();
|
|
||||||
} else {
|
|
||||||
if (is_array($message) || is_object($message)) {
|
|
||||||
$message = $this->arrayFormat($message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (is_array($message)) {
|
|
||||||
$message = $this->arrayFormat($message);
|
|
||||||
}
|
|
||||||
if (!empty($message)) {
|
if (!empty($message)) {
|
||||||
if (!is_array($this->logs)) {
|
if (!is_array($this->logs)) {
|
||||||
$this->logs = [];
|
$this->logs = [];
|
||||||
}
|
}
|
||||||
$this->logs[] = [$method, $message];
|
$this->logs[] = [$method, $message];
|
||||||
}
|
}
|
||||||
return $message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -150,7 +140,7 @@ class Logger extends Component
|
|||||||
public function getLastError(string $application = 'app'): mixed
|
public function getLastError(string $application = 'app'): mixed
|
||||||
{
|
{
|
||||||
$filetype = [];
|
$filetype = [];
|
||||||
foreach ($this->logs as $key => $val) {
|
foreach ($this->logs as $val) {
|
||||||
if ($val[0] != $application) {
|
if ($val[0] != $application) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -286,16 +276,7 @@ class Logger extends Component
|
|||||||
} else if (is_object($data)) {
|
} else if (is_object($data)) {
|
||||||
$data = get_object_vars($data);
|
$data = get_object_vars($data);
|
||||||
}
|
}
|
||||||
|
return Json::encode($data);
|
||||||
$filetype = [];
|
|
||||||
foreach ($data as $key => $val) {
|
|
||||||
if (is_array($val)) {
|
|
||||||
$filetype[] = $this->arrayFormat($val);
|
|
||||||
} else {
|
|
||||||
$filetype[] = (is_string($key) ? $key . ' : ' : '') . $val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return implode(PHP_EOL, $filetype);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user