Beispiel #1
0
 public function addLogItem(LogItem $item)
 {
     $item->setMicrotime($this->getTime());
     foreach ($this->listeners as $listener) {
         $listener->addLogItem($item);
     }
 }
 private function getFirePHPType(LogItem $item)
 {
     $type = $item->getType();
     if (isset($this->typeMapping[$type])) {
         $type = $this->typeMapping[$type];
     } else {
         $type = FirePHP::LOG;
     }
     return $type;
 }
 public function testSetTypeWithInvalidTypeThrowsException()
 {
     try {
         $item = new LogItem('Test log title');
         $item->setType(-1);
     } catch (Exception $e) {
         return;
     }
     $this->fail();
 }
 private function getLogItem($name)
 {
     $title = 'title';
     $message = 'message';
     $type = LogItem::INFORMATION;
     $name = $name;
     $item = new LogItem($title, $message, $type, $name);
     $item->setMicrotime('0.001');
     return $item;
 }
Beispiel #5
0
 public function allowLogItem(LogItem $item)
 {
     $name = $item->getName();
     $allowed = false;
     if (in_array($name, $this->names)) {
         $allowed = true;
     }
     if ($this->willInvert()) {
         $allowed = !$allowed;
     }
     return $allowed;
 }
 /**
  * Get the output string of a log item
  * @param LogItem
  */
 protected function getLogItemOutput(LogItem $item)
 {
     $output = '';
     $output = date($this->getDateFormat(), $item->getDate());
     $output .= self::FIELD_SEPARATOR . substr($item->getMicroTime(), 0, 5);
     $output .= self::FIELD_SEPARATOR . $item->getIP();
     $output .= self::FIELD_SEPARATOR . str_pad($item->getName(), 9);
     $output .= self::FIELD_SEPARATOR . str_pad(Formatter::formatSize(memory_get_usage()), 9, ' ', STR_PAD_LEFT);
     $output .= self::FIELD_SEPARATOR . $item->getType();
     $output .= self::FIELD_SEPARATOR . $item->getTitle();
     $message = $item->getMessage();
     if (!empty($message)) {
         $output .= self::FIELD_SEPARATOR . $message;
     }
     $output .= "\n";
     return $output;
 }