diff --git a/misc/tools.php b/misc/tools.php index e69c6b5..847d8e8 100644 --- a/misc/tools.php +++ b/misc/tools.php @@ -1,9 +1,16 @@ $trace) { + // Skip the first entry as it's the current function call + if ($index === 0) { + continue; + } + + // Build the log message for each stack frame + $logMessage .= "#{$index} "; + if (isset($trace['file'])) { + $logMessage .= "File: {$trace['file']} "; + } + if (isset($trace['line'])) { + $logMessage .= "Line: {$trace['line']} "; + } + if (isset($trace['function'])) { + $logMessage .= "Function: {$trace['function']} "; + } + $logMessage .= "\n"; + } + + // Log the stack trace to the error log + error_log($logMessage); + } + ?>