diff --git a/src/app/common.php b/src/app/common.php index ff1056f6a..edc2d1e6a 100644 --- a/src/app/common.php +++ b/src/app/common.php @@ -2135,12 +2135,13 @@ function exportForLog($data): string * @param string $msg 日志内容 * @param string $level 日志级别 debug、info、warning、error * @param string $file 日志文件名(不含路径) + * @param int $callerDep 调用栈深度,默认1(当前函数调用) */ -function log_write(string $message, string $level = 'info', string $filename = ''): void +function log_write(string $message, string $level = 'info', string $filename = '', int $callerDep = 1): void { // 日志文件最大大小(字节) $maxFileSize = 10485760; // 10MB - $callerInfo = CallerInfo::getCallerInfo(1); + $callerInfo = CallerInfo::getCallerInfo($callerDep); // 格式化日志内容 $content = sprintf(