diff --git a/System/Abstracts/BaseObject.php b/System/Abstracts/BaseObject.php index dd665892..f90770e7 100644 --- a/System/Abstracts/BaseObject.php +++ b/System/Abstracts/BaseObject.php @@ -226,7 +226,7 @@ class BaseObject implements Configure if (!empty($file)) { $message .= PHP_EOL . "\033[41;37m[" . date('Y-m-d H:i:s') . '][ERROR]: ' . $file . "\033[0m"; } - $this->logger()->output($message . PHP_EOL); + $this->logger()->output($message . PHP_EOL, 'error'); } } diff --git a/System/Error/Logger.php b/System/Error/Logger.php index ccedb259..f993944f 100644 --- a/System/Error/Logger.php +++ b/System/Error/Logger.php @@ -14,6 +14,7 @@ use Snowflake\Abstracts\Component; use Snowflake\Abstracts\Config; use Snowflake\Core\Json; use Snowflake\Event; +use Snowflake\Exception\ConfigException; use Snowflake\Snowflake; use Swoole\Coroutine; use Throwable; @@ -133,9 +134,15 @@ class Logger extends Component /** * @param $message + * @param string $method + * @throws ConfigException */ - public function output($message) + public function output($message, string $method = 'default') { + if ($method !== 'error' && + Config::get('environment', 'pro') == 'pro') { + return; + } if (str_contains($message, 'Event::rshutdown(): Event::wait()')) { return; }