예제 #1
0
 /**
  * @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();
         }
     }
 }
예제 #2
0
function handleShutdown()
{
    v6_debug::dump();
    // 12/28/2014 - set the cookie.  May not want this in production if there is an error, etc.  You may need to move
    // this into the if clause below
    v6_cookie::set();
    @ob_end_flush();
    $error = error_get_last();
    if ($error !== NULL && $error['type'] == 1) {
        //        ob_end_clean();   // silently discard the output buffer contents.
        //        appSendMsgToVern('Error has occurred',$error);
        //        header( 'location:/fatal_error' );
        @ob_end_flush();
        // output what is stored in the internal buffer  (may not want this here in production)
        echo '<pre>' . var_export($error, true);
        v6_BackTrace();
        die('handleShutdown(): Cannot continue!');
    } else {
        @ob_end_flush();
        // output what is stored in the internal buffer
    }
}