From 092fe8524070374beea91d197fcc854b2539be8a Mon Sep 17 00:00:00 2001 From: bingcool <2437667702@qq.com> Date: Sat, 10 Jun 2023 18:35:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0stubs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Config/config-dev.php | 29 +++++++++++++++++++---------- swoolefy | 24 +++++++++++++++++++++--- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/Test/Config/config-dev.php b/Test/Config/config-dev.php index 0ca05b0f..e5e07b5c 100644 --- a/Test/Config/config-dev.php +++ b/Test/Config/config-dev.php @@ -32,24 +32,33 @@ 'log' => function($name) { $logger = new \Swoolefy\Util\Log($name); $logger->setChannel('application'); - if(isWorkerService()) { - $logPath = LOG_PATH.'/worker.log'; - if (isScriptService()) { - $logPath = LOG_PATH.'/script.log'; - } - $logger->setLogFilePath($logPath); - return $logger; + if(isDaemonService()) { + $logFilePath = LOG_PATH.'/daemon.log'; + }else if (isScriptService()) { + $logFilePath = LOG_PATH.'/script.log'; + }else if (isCronService()) { + $logFilePath = LOG_PATH.'/cron.log'; } else { - $logger->setLogFilePath(LOG_PATH.'/runtime.log'); - return $logger; + $logFilePath = LOG_PATH.'/runtime.log'; } + $logger->setLogFilePath($logFilePath); + return $logger; }, // 系统捕捉异常错误日志 'error_log' => function($name) { $logger = new \Swoolefy\Util\Log($name); $logger->setChannel('application'); - $logger->setLogFilePath(LOG_PATH.'/error.log'); + if(isDaemonService()) { + $logFilePath = LOG_PATH.'/daemon_error.log'; + }else if (isScriptService()) { + $logFilePath = LOG_PATH.'/script_error.log'; + }else if (isCronService()) { + $logFilePath = LOG_PATH.'/cron_error.log'; + } else { + $logFilePath = LOG_PATH.'/error.log'; + } + $logger->setLogFilePath($logFilePath); return $logger; }, diff --git a/swoolefy b/swoolefy index 173faf3a..18a3bab8 100755 --- a/swoolefy +++ b/swoolefy @@ -1094,7 +1094,16 @@ return [ 'log' => function(\$name) { \$logger = new \Swoolefy\Util\Log(\$name); \$logger->setChannel('application'); - \$logger->setLogFilePath(LOG_PATH.'/runtime.log'); + if(isDaemonService()) { + \$logFilePath = LOG_PATH.'/daemon.log'; + }else if (isScriptService()) { + \$logFilePath = LOG_PATH.'/script.log'; + }else if (isCronService()) { + \$logFilePath = LOG_PATH.'/cron.log'; + } else { + \$logFilePath = LOG_PATH.'/runtime.log'; + } + \$logger->setLogFilePath(\$logFilePath); return \$logger; }, @@ -1102,9 +1111,18 @@ return [ 'error_log' => function(\$name) { \$logger = new \Swoolefy\Util\Log(\$name); \$logger->setChannel('application'); - \$logger->setLogFilePath(LOG_PATH.'/error.log'); + if(isDaemonService()) { + \$logFilePath = LOG_PATH.'/daemon_error.log'; + }else if (isScriptService()) { + \$logFilePath = LOG_PATH.'/script_error.log'; + }else if (isCronService()) { + \$logFilePath = LOG_PATH.'/cron_error.log'; + } else { + \$logFilePath = LOG_PATH.'/error.log'; + } + \$logger->setLogFilePath(\$logFilePath); return \$logger; - }, + } ] ];