chore(event): 使用 log_write 记录日志
This commit is contained in:
@@ -5,7 +5,6 @@ namespace app\event\init;
|
||||
use app\model\system\Addon;
|
||||
use think\facade\Event;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 初始化插件
|
||||
@@ -35,7 +34,7 @@ class InitAddon
|
||||
|
||||
// 1. 记录总的addon数量和名称
|
||||
$total_addons = count($current_addon_names);
|
||||
Log::write("[Addon Init] 总插件数量: {$total_addons}, 插件列表: " . implode(', ', $current_addon_names), 'info');
|
||||
log_write("[Addon Init] 总插件数量: {$total_addons}, 插件列表: " . implode(', ', $current_addon_names), 'info');
|
||||
|
||||
// 2. 记录缓存中不存在但实际存在的addon
|
||||
$cache_addon_names = [];
|
||||
@@ -44,7 +43,7 @@ class InitAddon
|
||||
}
|
||||
$new_addons_in_cache = array_diff($current_addon_names, $cache_addon_names);
|
||||
if (!empty($new_addons_in_cache)) {
|
||||
Log::write("[Addon Init] 缓存中不存在但实际存在的插件: " . implode(', ', $new_addons_in_cache), 'info');
|
||||
log_write("[Addon Init] 缓存中不存在但实际存在的插件: " . implode(', ', $new_addons_in_cache), 'info');
|
||||
}
|
||||
|
||||
// 构建新的插件事件映射
|
||||
@@ -80,8 +79,8 @@ class InitAddon
|
||||
}
|
||||
|
||||
// 3. 记录注册和未注册事件监听的addon
|
||||
Log::write("[Addon Init] 注册了事件监听的插件: " . (empty($addons_with_events) ? '无' : implode(', ', $addons_with_events)), 'info');
|
||||
Log::write("[Addon Init] 未注册事件监听的插件: " . (empty($addons_without_events) ? '无' : implode(', ', $addons_without_events)), 'info');
|
||||
log_write("[Addon Init] 注册了事件监听的插件: " . (empty($addons_with_events) ? '无' : implode(', ', $addons_with_events)), 'info');
|
||||
log_write("[Addon Init] 未注册事件监听的插件: " . (empty($addons_without_events) ? '无' : implode(', ', $addons_without_events)), 'info');
|
||||
|
||||
// 获取当前所有事件名称
|
||||
$current_events = array_keys($new_merged_listeners);
|
||||
@@ -110,11 +109,11 @@ class InitAddon
|
||||
}
|
||||
|
||||
if (!empty($events_already_exists)) {
|
||||
Log::write("[Addon Init] 已存在的事件: " . implode(', ', $events_already_exists), 'info');
|
||||
log_write("[Addon Init] 已存在的事件: " . implode(', ', $events_already_exists), 'info');
|
||||
}
|
||||
|
||||
if (!empty($events_new_registered)) {
|
||||
Log::write("[Addon Init] 新注册的事件: " . implode(', ', $events_new_registered), 'info');
|
||||
log_write("[Addon Init] 新注册的事件: " . implode(', ', $events_new_registered), 'info');
|
||||
}
|
||||
|
||||
// 处理每个事件的监听器
|
||||
|
||||
Reference in New Issue
Block a user