Example #1
0
 /**
  * Function atkdebug.
  *
  * Adds debug self::text to the debug log
  *
  * @param string $txt The self::text that will be added to the log
  * @param int $flags An optional combination of Tools::DEBUG_ flags
  */
 public static function atkdebug($txt, $flags = 0)
 {
     global $g_debug_msg;
     $level = Config::getGlobal('debug');
     if ($level >= 0) {
         if (self::hasFlag($flags, self::DEBUG_HTML)) {
             $txt = htmlentities($txt);
         }
         if (self::hasFlag($flags, self::DEBUG_WARNING)) {
             $txt = '<b>' . $txt . '</b>';
         }
         $line = self::atkGetTimingInfo() . $txt;
         self::atkWriteLog($line);
         if (self::hasFlag($flags, self::DEBUG_ERROR)) {
             $line = '<span class="atkDebugError">' . $line . '</span>';
         }
         if ($level > 2) {
             if (!Debugger::addStatement($line)) {
                 $g_debug_msg[] = $line;
             }
         } else {
             if (!self::hasFlag($flags, self::DEBUG_NOTICE)) {
                 $g_debug_msg[] = $line;
             }
         }
     } else {
         if ($level > -1) {
             // at 0 we still collect the info so we
             // have it in error reports. At -1, we don't collect
             $g_debug_msg[] = $txt;
         }
     }
 }