I tried to achieve what I wanted and finally came up with a reasonable solution.
Create a class called Debug and include it above each file that you want to debug. Create a function that prints the information stored in $calls .
class Debug { private static $calls; public static function log($message = null) { if(!is_array(self::$calls)) self::$calls = array(); $call = debug_backtrace(false); $call = (isset($call[1]))?$call[1]:$call[0]; $call['message'] = $message; array_push(self::$calls, $call); } }
Call this function every time you declare the first function of a function in a function: Debug::log($message(optional) )
Henze
source share