Ejemplo n.º 1
0
 static function writeDebug($string, $label = "", $backgroundClass = "")
 {
     $alwaysLog = eZDebug::alwaysLogMessage(self::LEVEL_DEBUG);
     $enabled = eZDebug::isDebugEnabled();
     if (!$alwaysLog and !$enabled) {
         return;
     }
     $show = eZDebug::showMessage(self::SHOW_DEBUG);
     if (!$alwaysLog and !$show) {
         return;
     }
     if (is_object($string) || is_array($string)) {
         $string = eZDebug::dumpVariable($string);
     }
     $GLOBALS['eZDebugDebug'] = true;
     if (!isset($GLOBALS['eZDebugDebugCount'])) {
         $GLOBALS['eZDebugDebugCount'] = 0;
     }
     ++$GLOBALS['eZDebugDebugCount'];
     $debug = eZDebug::instance();
     if ($debug->HandleType == self::HANDLE_TO_PHP) {
         // If we get here only because of $alwaysLog we should not trigger a PHP error
         if ($enabled and $show) {
             if ($label) {
                 $string = "{$label}: {$string}";
             }
             trigger_error($string, E_USER_NOTICE);
         }
     } else {
         $debug->write($string, self::LEVEL_DEBUG, $label, $backgroundClass, $alwaysLog);
     }
 }