示例#1
0
 /**
  * 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
 /**
  * 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);
 }