/** * @param string $filename * @default '' * * 12/26/2014 - the name of the textfile you want to log to * */ public static function dump($filename = '') { // error_log(self::$textfile); // error_log(v6_debug::$textfile); if (self::$debug == true) { // 12/26/2014 - added defaulting to debug::textfile if (empty($filename) == true) { $filename = self::$textfile; } if (strlen($filename) > 0) { $fh = fopen($filename, 'a') or die("debug::dump() - can't open file " . $filename); fseek($fh, 0, SEEK_END); foreach (self::$calls as $c) { fwrite($fh, $c['message'] . ' ' . $c['Date/Time'] . ' ' . substr(' (' . $c['line'], -5) . ') ' . $c['file']); fwrite($fh, "\r\n"); } fclose($fh); } else { // 12/26/2014 - If no filename is specified then simply echo the debug info to the screen. // THIS COULD BE DANGEROUS! echo '<pre>'; echo var_export(self::$calls, true); echo '</pre>'; } // 12//26/2014 - If in immediate mode, then clear the call stack if (self::$immediate == true) { self::$calls = array(); } } }