示例#1
0
 /**
  * Returns information about this particular trace event.
  *
  * @returns array with with time, caller data and code snippet
  */
 private function getInfoArray()
 {
     $info = array();
     $caller = TraceUtil::getCallerData(2);
     $class = isset($caller['class']) ? $caller['class'] : "";
     $class = preg_replace("@.*\\\\@", "", $class);
     $function = $caller['function'];
     $caller = TraceUtil::getCallerData(1);
     $file = $caller['file'];
     $line = $caller['line'];
     $snippet = CodeSnippet::getCodeSnippet($file, $line, 5);
     $info['class'] = $class;
     $info['function'] = $function;
     $info['line'] = $line;
     $info['file'] = $file;
     $info['snippet'] = $snippet;
     $info['elapsedTime'] = $this->timer->getElapsedTime();
     return $info;
 }
示例#2
0
 /**
  * Writes information about current Trace event
  *
  */
 private function writeEntry($parent, $logMsg, $userData, $tags)
 {
     Preconditions::checkIsString($logMsg);
     $caller = TraceUtil::getCallerData(2);
     $class = isset($caller['class']) ? $caller['class'] : "N/A";
     $class = preg_replace("@.*\\\\@", "", $class);
     $function = isset($caller['function']) ? $caller['function'] : 'N/A';
     $caller = TraceUtil::getCallerData(1);
     $file = isset($caller['file']) ? $caller['file'] : 'N/A';
     $line = isset($caller['line']) ? $caller['line'] : 'N/A';
     $traceInfo = array('elapsed' => $this->timer->getElapsedTime(), 'timestamp' => time(), 'class' => $class, 'function' => $function, 'file' => $file, 'line' => $line);
     if ($tags != null) {
         $traceInfo = array_merge($tags, $traceInfo);
     }
     $serialized = $this->stream->serialize($logMsg);
     $serialized .= $this->stream->serialize($traceInfo);
     $serialized .= $this->stream->serialize($userData);
     $id = $this->stream->writeEntry(EntryStream::ENTRY_TRACE, $parent, $serialized);
     return $id;
 }
示例#3
0
 /**
  * Writes information about current Trace event
  *
  */
 private function writeInfo()
 {
     $caller = TraceUtil::getCallerData(2);
     $class = isset($caller['class']) ? $caller['class'] : "N/A";
     $class = preg_replace("@.*\\\\@", "", $class);
     $function = isset($caller['function']) ? $caller['function'] : 'N/A';
     $caller = TraceUtil::getCallerData(1);
     $file = isset($caller['file']) ? $caller['file'] : 'N/A';
     $line = isset($caller['line']) ? $caller['line'] : 'N/A';
     $this->writeInfoLine("Time: " . $this->timer->getElapsedTime() . ' (' . date('d.M.Y H:i:s') . ')');
     $this->writeInfoLine("Class: " . $class);
     $this->writeInfoLine("Function: " . $function);
     $this->writeInfoLine("File: " . $file);
     $this->writeInfoLine("Line: " . $line);
 }