debug.log 保留策略:只留最近3天+≤5MB,任一超标即清理到两条件同时满足
This commit is contained in:
@@ -45,6 +45,11 @@ function debugLog($msg, $ctx = []) {
|
||||
if ($ctx) $entry .= ' | Context: ' . json_encode($ctx, JSON_UNESCAPED_UNICODE);
|
||||
$entry .= "\n";
|
||||
@file_put_contents($logFile, $entry, FILE_APPEND | LOCK_EX);
|
||||
// ★ 保留策略(2026-10-05):只留最近3天 + ≤5MB,任一超标即清理到两条件同时满足
|
||||
if (is_file(__DIR__ . '/../log_maintain.php')) {
|
||||
@require_once __DIR__ . '/../log_maintain.php';
|
||||
if (function_exists('logMaintain')) { @logMaintain($logFile); }
|
||||
}
|
||||
}
|
||||
} // end if (!function_exists('debugLog'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user