コード例 #1
0
ファイル: PLUGCli.php プロジェクト: vitek-rostislav/jparser
 /**
  * Standard error logger printing to stderr with program name
  */
 static function format_logline(PLUGError $Err)
 {
     if (PLUG::is_compiled()) {
         return sprintf('%s: %s: %s', basename(self::arg(0)), $Err->getTypeString(), $Err->getMessage());
     } else {
         return sprintf('%s: %s: %s in %s#%u', basename(self::arg(0)), $Err->getTypeString(), $Err->getMessage(), basename($Err->getFile()), $Err->getLine());
     }
 }
コード例 #2
0
ファイル: PLUG.php プロジェクト: vitek-rostislav/jparser
 /**
  * Register script termination function
  * @param string | array handler callable with call_user_func
  * @return bool
  */
 static function set_error_terminator($handler)
 {
     if (!is_callable($handler)) {
         trigger_error('Fatal error handler is not callable (' . var_export($handler, 1) . ')', E_USER_WARNING);
         return false;
     }
     PLUGError::$deathfunc = $handler;
     return true;
 }
コード例 #3
0
ファイル: PLUGError.php プロジェクト: vitek-rostislav/jparser
 /**
  * Default error formatting function
  * @param PLUGError
  * @return string
  */
 static function display(PLUGError $Err)
 {
     $html = ini_get('html_errors');
     if ($html) {
         $s = '<div class="error"><strong>%s:</strong> %s. in <strong>%s</strong> on line <strong>%u</strong></div>';
     } else {
         $s = "\n%s: %s. in %s on line %u";
     }
     $args = array($s, $Err->getTypeString(), $Err->getMessage(), $Err->getFile(), $Err->getLine());
     // add trace in dev mode
     if (!PLUG::is_compiled()) {
         $args[0] .= $html ? "\n<pre>%s</pre>" : "\n%s";
         $args[] = $Err->getTraceAsString();
     }
     return call_user_func_array('sprintf', $args);
 }
コード例 #4
0
 /**
  * Dump errors raised in this object.
  * @param int php error level constant
  * @return array
  */
 function dump_errors($emask = null)
 {
     foreach ($this->err_stack as $t => $ids) {
         if ($emask !== NULL && ($emask & $t) == 0) {
             // ignore this error
             continue;
         }
         // dump these errors
         foreach ($ids as $id) {
             $Err = PLUGError::get_reference($t, $id);
             echo (string) $Err;
             echo $Err->getTraceAsString(), "\n";
         }
     }
 }