/**
  * @param LogItem $item
  * @return string HTML 
  */
 public function showDebugItem(LogItem $item)
 {
     if ($item->m_debug_backtrace != null) {
         $debug = "<h4>Trace:</h4>\n\t\t\t\t\t <ul>";
         foreach ($item->m_debug_backtrace as $key => $row) {
             //the two topmost items are part of the logger
             //skip those
             if ($key < 2) {
                 continue;
             }
             $key = $key - 2;
             $debug .= "<li> {$key} " . LogItem::cleanFilePath($row['file']) . " Line : " . $row["line"] . "</li>";
         }
         $debug .= "</ul>";
     } else {
         $debug = "";
     }
     if ($item->m_object != null) {
         $object = print_r($item->m_object, true);
     } else {
         $object = "";
     }
     list($usec, $sec) = explode(" ", $item->m_microTime);
     $date = date("Y-m-d H:i:s", $sec);
     $ret = "<li>\n\t\t\t\t\t<Strong>{$item->m_message} </strong> {$item->m_calledFrom} \n\t\t\t\t\t<div style='font-size:small'>{$date} {$usec}</div>\n\t\t\t\t\t<pre>{$object}</pre>\n\t\t\t\t\t\n\t\t\t\t\t{$debug}\n\t\t\t\t\t\n\t\t\t\t</li>";
     return $ret;
 }
Esempio n. 2
0
 /**
  * @param LogItem $item
  * @return string HTML
  */
 private function showLogItem($logItem)
 {
     if ($logItem->m_debug_backtrace != null) {
         $debug = "<h4>Trace:</h4>\n\t\t\t\t\t <ul>";
         foreach ($logItem->m_debug_backtrace as $key => $row) {
             //the two topmost items are part of the logger
             //skip those
             if ($key < 2) {
                 continue;
             }
             $key = $key - 2;
             $debug .= "<li> {$key} " . LogItem::cleanFilePath($row['file']) . " Line : " . $row["line"] . "</li>";
         }
         $debug .= "</ul>";
     } else {
         $debug = "";
     }
     if ($logItem->m_object != null) {
         $object = print_r($logItem->m_object, true);
     } else {
         $object = "";
     }
     $date = $this->convertMicroTime($logItem->m_microTime);
     $ret = "<li>\n\t\t\t\t\t<strong>{$logItem->m_message} </strong> {$logItem->m_calledFrom}\n\t\t\t\t\t<div style='font-size:small'>{$date}</div>\n\t\t\t\t\t<pre>{$object}</pre>\n\n\t\t\t\t\t{$debug}\n\n\t\t\t\t</li>";
     return $ret;
 }
 static function Instance()
 {
     if (!isset(self::$mInstance)) {
         self::$mInstance = new SysLogObj();
     }
     return self::$mInstance;
 }
Esempio n. 4
0
 function DoLog($message = "", $category = "public")
 {
     if (!Configuration::Instance()->GetValue('application', 'syslog_enabled')) {
         return;
     }
     if (!ini_get('date.timezone')) {
         date_default_timezone_set('GMT');
     }
     $timestamp = date('Y/m/d h:i:s');
     $logitem = new LogItem();
     $logitem->newLog();
     $logitem->SetLogTimestamp($timestamp);
     $logitem->SetLogType($category);
     $logitem->SetLogMessage($message);
     $this->_saveLog($category, $logitem->getLogData());
 }
Esempio n. 5
0
                 // 2 hours
                 if ($lastPlay > time() - 3600) {
                     $trackHotness = "danger";
                 }
                 // 1 hour
             }
             $return .= "\r\n\t\t\t\t\t\t\t\t<tr data-track-id=\"" . $track->get_id() . "\" class=\"track " . $trackHotness . "\">\r\n\t\t\t\t\t\t\t\t\t<td class=\"icon\">" . Bootstrap::glyphicon("music") . "</td>\r\n\t\t\t\t\t\t\t\t\t<td class=\"artist nowrap\">" . $track->get_artists_str() . "</td>\r\n\t\t\t\t\t\t\t\t\t<td class=\"title nowrap\">" . $track->get_title() . "</td>\r\n\t\t\t\t\t\t\t\t\t<td class=\"album nowrap\">" . $track->get_album()->get_name() . "</td>\r\n\t\t\t\t\t\t\t\t\t<td class=\"length nowrap\">" . Time::format_succinct($track->get_length()) . "</td>\r\n\t\t\t\t\t\t\t\t</tr>";
         }
         $return .= "\r\n\t\t\t\t\t\t\t</tbody>\r\n\t\t\t\t\t\t</table>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t";
         $first = false;
     }
     echo $return;
     break;
 case "log":
     if (isset($_REQUEST["title"])) {
         $log = new LogItem();
         $log->set_location($location);
         if (Session::is_user()) {
             $log->set_user(Session::get_user());
         }
         $log->set_track_title($_REQUEST["title"]);
         $log->set_track_artist($_REQUEST["artist"]);
         $log->save();
     }
     $logitems = LogItems::get($location, "datetime DESC", 20, NULL);
     $return = "<table class=\"table table-striped table-hover\">\r\n\t\t\t<thead>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th class=\"icon\"></th>\r\n\t\t\t\t\t<th class=\"artist\">Artist</th>\r\n\t\t\t\t\t<th class=\"title\">Title</th>\r\n\t\t\t\t\t<th class=\"datetime\">Date/Time</th>\r\n\t\t\t\t</tr>\r\n\t\t\t</thead>\r\n\t\t\t<tbody>";
     foreach ($logitems as $logitem) {
         $return .= "<tr data-log-id=\"logitem-" . $logitem->get_id() . "\">\r\n\t\t\t\t<td class=\"icon\">" . Bootstrap::glyphicon("headphones") . "</td>\r\n\t\t\t\t<td class=\"artist nowrap\">" . $logitem->get_track_artist() . "</td>\r\n\t\t\t\t<td class=\"title nowrap\">" . $logitem->get_track_title() . "</td>\r\n\t\t\t\t<td class=\"datetime nowrap\">" . date("d/m/y H:i", $logitem->get_datetime()) . "</td>\r\n\t\t\t</tr>";
     }
     $return .= "</tbody></table>";
     echo $return;