diff --git a/Kafka/Kafka.php b/Kafka/Kafka.php index 45953d23..7ba8c034 100644 --- a/Kafka/Kafka.php +++ b/Kafka/Kafka.php @@ -173,8 +173,8 @@ class Kafka extends \Snowflake\Process\Process $conf->set('metadata.broker.list', $kafka['brokers']); $conf->set('socket.timeout.ms', '30000'); - logger()->debug('kafka listen groupId ' . $kafka['groupId']); - logger()->debug('kafka listen brokers ' . $kafka['brokers']); + debug('kafka listen groupId ' . $kafka['groupId']); + debug('kafka listen brokers ' . $kafka['brokers']); if (function_exists('pcntl_sigprocmask')) { pcntl_sigprocmask(SIG_BLOCK, array(SIGIO)); diff --git a/Kafka/Logger.php b/Kafka/Logger.php index 9a01f656..0bda11bf 100644 --- a/Kafka/Logger.php +++ b/Kafka/Logger.php @@ -30,7 +30,6 @@ class Logger implements LoggerInterface /** * @param string $message * @param array $context - * @throws ComponentException * @throws Exception */ public function alert(mixed $message, array $context = array()) @@ -48,7 +47,6 @@ class Logger implements LoggerInterface /** * @param string $message * @param array $context - * @throws ComponentException * @throws Exception */ public function error(mixed $message, array $context = array()) @@ -60,7 +58,7 @@ class Logger implements LoggerInterface /** * @param string $message * @param array $context - * @throws ComponentException + * @throws Exception */ public function warning(mixed $message, array $context = array()) { @@ -71,7 +69,7 @@ class Logger implements LoggerInterface /** * @param string $message * @param array $context - * @throws ComponentException + * @throws Exception */ public function notice(mixed $message, array $context = array()) { @@ -82,7 +80,7 @@ class Logger implements LoggerInterface /** * @param string $message * @param array $context - * @throws ComponentException + * @throws Exception */ public function info(mixed $message, array $context = array()) { @@ -94,7 +92,6 @@ class Logger implements LoggerInterface /** * @param string $message * @param array $context - * @throws ComponentException * @throws Exception */ public function debug(mixed $message, array $context = array()) @@ -107,7 +104,6 @@ class Logger implements LoggerInterface * @param $level * @param $message * @param array $context - * @throws ComponentException * @throws Exception */ public function log($level, mixed $message, array $context = array()) diff --git a/System/Process/ServerInotify.php b/System/Process/ServerInotify.php index 7a8f93a6..df488e66 100644 --- a/System/Process/ServerInotify.php +++ b/System/Process/ServerInotify.php @@ -282,8 +282,7 @@ class ServerInotify extends Process if (str_contains($message, 'The file descriptor is not an inotify instance')) { return; } - logger()->debug('Error:' . $message); - logger()->debug($file . ':' . $line); + debug('Error:' . $message . ' at ' . $file . ':' . $line); } diff --git a/function.php b/function.php index 10dc37c2..78d76386 100644 --- a/function.php +++ b/function.php @@ -848,7 +848,6 @@ if (!function_exists('swoole_substr_json_decode')) { if (!function_exists('swoole_substr_unserialize')) { - /** * @param $packet * @param int $length @@ -860,3 +859,45 @@ if (!function_exists('swoole_substr_unserialize')) { } } + + +if (!function_exists('debug')) { + + /** + * @param $message + * @param string $method + * @throws Exception + */ + function debug(mixed $message, string $method = 'app') + { + Snowflake::app()->debug($message, $method); + } + +} + +if (!function_exists('error')) { + + /** + * @param $message + * @param string $method + * @throws Exception + */ + function error(mixed $message, $method = 'error') + { + Snowflake::app()->error($message, $method); + } +} + +if (!function_exists('success')) { + + /** + * @param $message + * @param string $method + * @throws Exception + */ + function success(mixed $message, $method = 'app') + { + Snowflake::app()->success($message, $method); + } +} +