多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
* 配置 Log组件是基于Monolog组件封装实现的,在应用层配置文件中 ~~~ 'components' => [ 'log' => [ 'class' => 'Swoolefy\Tool\Log', 'channel’=> 'Application', 'logFilePath' => rtrim(LOG_PATH,'/').'/runtime.log'; ], ] ~~~ 可选的全局配置项: channel:是指log保存的主题 logFilePath:log存储日志文件路径 output:日志输出格式,默认格式`"[%datetime%] %channel% > %level_name% : %message% \n"`,可以参考Monolog组件 在实际使用中也可以覆盖默认的全局配置,例如: ~~~ switch($errorType) { case 'error': Application::getApp()->log->setChannel('Application')->setLogFilePath($logFilePath)->addError($errorMsg); break; case 'warning': Application::getApp()->log->setChannel('Application')->setLogFilePath($logFilePath)->addWarning($errorMsg); break; case 'notice': Application::getApp()->log->setChannel('Application')->setLogFilePath($logFilePath)->addNotice($errorMsg); break; case 'info': Application::getApp()->log->setChannel('Application')->setLogFilePath($logFilePath)->addInfo($errorMsg); break; } ~~~ 函数setChannel()可以覆盖原来组件定义的信道 函数setLogFilePath()可以覆盖原来组件定义的文件路径