예제 #1
0
 function writeTimedString($string, $label = '')
 {
     if ($this->file) {
         $time = $this->getTime();
         if (is_object($string) || is_array($string)) {
             $string = eZDebug::dumpVariable($string);
         }
         if ($label == '') {
             fputs($this->file, $time . '  ' . $string . "\n");
         } else {
             fputs($this->file, $time . '  ' . $label . ': ' . $string . "\n");
         }
     }
 }
예제 #2
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);
     }
 }
 private function debug( $string, $label, $level = eZDebug::LEVEL_DEBUG )
 {
     if ( empty( $this->cli ) )
     {
         $debug = eZDebug::instance();
         $debug->write( $string, $level, $label );
     }
     else
     {
         $label = date( DATE_ATOM ) . ' -- ' . $label;
         $this->cli->output( $label . " :" );
         if ( is_object( $string ) || is_array( $string ) )
         {
             $string = eZDebug::dumpVariable( $string );
         }
         $this->cli->output( $string );
     }
 }