Пример #1
0
 /**
  * Short description of method dolog
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  Item item
  * @return mixed
  */
 public function dolog(common_log_Item $item)
 {
     if (is_null($this->filehandle)) {
         $this->initFile();
     }
     if ($this->filehandle !== false) {
         $map = array('%d' => date('Y-m-d H:i:s', $item->getDateTime()), '%m' => $item->getDescription(), '%p' => $this->prefix, '%s' => $item->getSeverityDescriptionString(), '%t' => $item->getDateTime(), '%r' => $item->getRequest(), '%f' => $item->getCallerFile(), '%l' => $item->getCallerLine());
         if (strpos($this->format, '%b')) {
             $map['%b'] = 'Backtrace not yet supported';
         }
         $str = strtr($this->format, $map) . PHP_EOL;
         @fwrite($this->filehandle, $str);
     }
 }
Пример #2
0
 /**
  * Short description of method doLog
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  Item item
  * @return mixed
  */
 public function doLog(common_log_Item $item)
 {
     $doc = new DOMDocument();
     $doc->preserveWhiteSpace = false;
     $doc->formatOutput = true;
     $success = @$doc->load($this->filename);
     if (!$success) {
         $doc->loadXML('<events></events>');
     }
     $event_element = $doc->createElement("event");
     $message = $doc->createElement("description");
     $message->appendChild($doc->createCDATASection($item->getDescription()));
     $event_element->appendChild($message);
     $file = $doc->createElement("file");
     $file->appendChild($doc->createCDATASection($item->getCallerFile()));
     $event_element->appendChild($file);
     $line = $doc->createElement("line");
     $line->appendChild($doc->createCDATASection($item->getCallerLine()));
     $event_element->appendChild($line);
     $datetime = $doc->createElement("datetime");
     $datetime->appendChild($doc->createCDATASection($item->getDateTime()));
     $event_element->appendChild($datetime);
     $severity = $doc->createElement("severity");
     $severity->appendChild($doc->createCDATASection($item->getSeverity()));
     $event_element->appendChild($severity);
     $doc->documentElement->appendChild($event_element);
     @$doc->save($this->filename);
 }