当前位置: 首页>>代码示例>>PHP>>正文


PHP LoggerLoggingEvent::getLocationInformation方法代码示例

本文整理汇总了PHP中LoggerLoggingEvent::getLocationInformation方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerLoggingEvent::getLocationInformation方法的具体用法?PHP LoggerLoggingEvent::getLocationInformation怎么用?PHP LoggerLoggingEvent::getLocationInformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LoggerLoggingEvent的用法示例。


在下文中一共展示了LoggerLoggingEvent::getLocationInformation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: format

 public function format(LoggerLoggingEvent $event)
 {
     // If required, initialize the location data
     if ($this->locationInfo) {
         $event->getLocationInformation();
     }
     return serialize($event) . PHP_EOL;
 }
开发者ID:HaakonME,项目名称:noark5-validator,代码行数:8,代码来源:LoggerLayoutSerialized.php

示例2: convert

 public function convert(LoggerLoggingEvent $event)
 {
     $name = $event->getLocationInformation()->getClassName();
     if (!isset($this->cache[$name])) {
         // If length is set return shortened class name
         if (isset($this->length)) {
             $this->cache[$name] = LoggerUtils::shortenClassName($name, $this->length);
         } else {
             $this->cache[$name] = $name;
         }
     }
     return $this->cache[$name];
 }
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:13,代码来源:LoggerPatternConverterClass.php

示例3: convert

 /**
  * @param LoggerLoggingEvent $event
  * @return string
  */
 public function convert($event)
 {
     $locationInfo = $event->getLocationInformation();
     switch ($this->type) {
         case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_FULL_LOCATION_CONVERTER:
             return $locationInfo->getFullInfo();
         case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_METHOD_LOCATION_CONVERTER:
             return $locationInfo->getMethodName();
         case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_LINE_LOCATION_CONVERTER:
             return $locationInfo->getLineNumber();
         case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_FILE_LOCATION_CONVERTER:
             return $locationInfo->getFileName();
         default:
             return '';
     }
 }
开发者ID:dobreapa,项目名称:owasp-esapi-php,代码行数:20,代码来源:LoggerLocationPatternConverter.php

示例4: convert

 /**
  * @param LoggerLoggingEvent $event
  * @return string
  */
 public function convert($event)
 {
     $locationInfo = $event->getLocationInformation();
     switch ($this->type) {
         case LoggerPatternParser::FULL_LOCATION_CONVERTER:
             return $locationInfo->getFullInfo();
         case LoggerPatternParser::METHOD_LOCATION_CONVERTER:
             return $locationInfo->getMethodName();
         case LoggerPatternParser::LINE_LOCATION_CONVERTER:
             return $locationInfo->getLineNumber();
         case LoggerPatternParser::FILE_LOCATION_CONVERTER:
             return $locationInfo->getFileName();
         case LoggerPatternParser::CLASS_LOCATION_CONVERTER:
             return $locationInfo->getFullQualifiedClassname();
         default:
             return '';
     }
 }
开发者ID:unkerror,项目名称:Budabot,代码行数:22,代码来源:LoggerLocationPatternConverter.php

示例5: format

 /**
  * Converts the logging event into an array which can be logged to mongodb.
  * 
  * @param LoggerLoggingEvent $event
  * @return array The array representation of the logging event.
  */
 protected function format(LoggerLoggingEvent $event)
 {
     $timestampSec = (int) $event->getTimestamp();
     $timestampUsec = (int) (($event->getTimestamp() - $timestampSec) * 1000000);
     $document = array('timestamp' => new MongoDate($timestampSec, $timestampUsec), 'level' => $event->getLevel()->toString(), 'thread' => (int) $event->getThreadName(), 'message' => $event->getMessage(), 'loggerName' => $event->getLoggerName());
     $locationInfo = $event->getLocationInformation();
     if ($locationInfo != null) {
         $document['fileName'] = $locationInfo->getFileName();
         $document['method'] = $locationInfo->getMethodName();
         $document['lineNumber'] = $locationInfo->getLineNumber() == 'NA' ? 'NA' : (int) $locationInfo->getLineNumber();
         $document['className'] = $locationInfo->getClassName();
     }
     $throwableInfo = $event->getThrowableInformation();
     if ($throwableInfo != null) {
         $document['exception'] = $this->formatThrowable($throwableInfo->getThrowable());
     }
     return $document;
 }
开发者ID:alexandreannic,项目名称:android-holo-colors,代码行数:24,代码来源:LoggerAppenderMongoDB.php

示例6: format

 /**
  * @param LoggerLoggingEvent $event
  * @return string
  */
 public function format(LoggerLoggingEvent $event)
 {
     $sbuf = PHP_EOL . "<tr>" . PHP_EOL;
     $sbuf .= "<td>";
     $sbuf .= $event->getTime();
     $sbuf .= "</td>" . PHP_EOL;
     $sbuf .= "<td title=\"" . $event->getThreadName() . " thread\">";
     $sbuf .= $event->getThreadName();
     $sbuf .= "</td>" . PHP_EOL;
     $sbuf .= "<td title=\"Level\">";
     $level = $event->getLevel();
     if ($level->equals(LoggerLevel::getLevelDebug())) {
         $sbuf .= "<font color=\"#339933\">{$level}</font>";
     } else {
         if ($level->equals(LoggerLevel::getLevelWarn())) {
             $sbuf .= "<font color=\"#993300\"><strong>{$level}</strong></font>";
         } else {
             $sbuf .= $level;
         }
     }
     $sbuf .= "</td>" . PHP_EOL;
     $sbuf .= "<td title=\"" . htmlentities($event->getLoggerName(), ENT_QUOTES) . " category\">";
     $sbuf .= htmlentities($event->getLoggerName(), ENT_QUOTES);
     $sbuf .= "</td>" . PHP_EOL;
     if ($this->locationInfo) {
         $locInfo = $event->getLocationInformation();
         $sbuf .= "<td>";
         $sbuf .= htmlentities($locInfo->getFileName(), ENT_QUOTES) . ':' . $locInfo->getLineNumber();
         $sbuf .= "</td>" . PHP_EOL;
     }
     $sbuf .= "<td title=\"Message\">";
     $sbuf .= htmlentities($event->getRenderedMessage(), ENT_QUOTES);
     $sbuf .= "</td>" . PHP_EOL;
     $sbuf .= "</tr>" . PHP_EOL;
     if ($event->getNDC() != null) {
         $sbuf .= "<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">";
         $sbuf .= "NDC: " . htmlentities($event->getNDC(), ENT_QUOTES);
         $sbuf .= "</td></tr>" . PHP_EOL;
     }
     return $sbuf;
 }
开发者ID:unkerror,项目名称:Budabot,代码行数:45,代码来源:LoggerLayoutHtml.php

示例7: convert

 public function convert(LoggerLoggingEvent $event)
 {
     return $event->getLocationInformation()->getLineNumber();
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:4,代码来源:LoggerPatternConverterLine.php

示例8: format

 /**
  * Formats a {@link LoggerLoggingEvent} in conformance with the log4php.dtd.
  *
  * @param LoggerLoggingEvent $event        	
  * @return string
  */
 public function format(LoggerLoggingEvent $event)
 {
     $ns = $this->namespacePrefix;
     $loggerName = $event->getLoggerName();
     $timeStamp = number_format((double) ($event->getTimeStamp() * 1000), 0, '', '');
     $thread = $event->getThreadName();
     $level = $event->getLevel()->toString();
     $buf = "<{$ns}:event logger=\"{$loggerName}\" level=\"{$level}\" thread=\"{$thread}\" timestamp=\"{$timeStamp}\">" . PHP_EOL;
     $buf .= "<{$ns}:message>";
     $buf .= $this->encodeCDATA($event->getRenderedMessage());
     $buf .= "</{$ns}:message>" . PHP_EOL;
     $ndc = $event->getNDC();
     if (!empty($ndc)) {
         $buf .= "<{$ns}:NDC><![CDATA[";
         $buf .= $this->encodeCDATA($ndc);
         $buf .= "]]></{$ns}:NDC>" . PHP_EOL;
     }
     $mdcMap = $event->getMDCMap();
     if (!empty($mdcMap)) {
         $buf .= "<{$ns}:properties>" . PHP_EOL;
         foreach ($mdcMap as $name => $value) {
             $buf .= "<{$ns}:data name=\"{$name}\" value=\"{$value}\" />" . PHP_EOL;
         }
         $buf .= "</{$ns}:properties>" . PHP_EOL;
     }
     if ($this->getLocationInfo()) {
         $locationInfo = $event->getLocationInformation();
         $buf .= "<{$ns}:locationInfo " . "class=\"" . $locationInfo->getClassName() . "\" " . "file=\"" . htmlentities($locationInfo->getFileName(), ENT_QUOTES) . "\" " . "line=\"" . $locationInfo->getLineNumber() . "\" " . "method=\"" . $locationInfo->getMethodName() . "\" ";
         $buf .= "/>" . PHP_EOL;
     }
     $buf .= "</{$ns}:event>" . PHP_EOL;
     return $buf;
 }
开发者ID:josefd8,项目名称:dashboardWeb,代码行数:39,代码来源:LoggerLayoutXml.php

示例9: convert

 public function convert(LoggerLoggingEvent $event)
 {
     return $event->getLocationInformation()->getClassName() . '.' . $event->getLocationInformation()->getMethodName() . '(' . $event->getLocationInformation()->getFileName() . ':' . $event->getLocationInformation()->getLineNumber() . ')';
 }
开发者ID:gustavoghioldi,项目名称:Plugin-opencart2,代码行数:4,代码来源:LoggerPatternConverterLocation.php

示例10: convert

 public function convert(LoggerLoggingEvent $event)
 {
     return $event->getLocationInformation()->getMethodName();
 }
开发者ID:jjaferson,项目名称:ourives,代码行数:4,代码来源:LoggerPatternConverterMethod.php

示例11: format

 public function format(LoggerLoggingEvent $event)
 {
     LoggerLoggingEventTest::$locationInfo = $event->getLocationInformation();
     LoggerLoggingEventTest::$throwableInfo = $event->getThrowableInformation();
 }
开发者ID:keehao,项目名称:Php-Object-Framework,代码行数:5,代码来源:LoggerLoggingEventTest.php

示例12: format

 /**
  * Formats a {@link LoggerLoggingEvent} in conformance with the log4php.dtd.
  *
  * @param LoggerLoggingEvent $event
  * @return string
  */
 public function format(LoggerLoggingEvent $event)
 {
     $loggerName = $event->getLoggerName();
     $timeStamp = number_format((double) ($event->getTimeStamp() * 1000), 0, '', '');
     $thread = $event->getThreadName();
     $level = $event->getLevel();
     $levelStr = $level->toString();
     $buf = "<{$this->_namespacePrefix}:event logger=\"{$loggerName}\" level=\"{$levelStr}\" thread=\"{$thread}\" timestamp=\"{$timeStamp}\">" . PHP_EOL;
     $buf .= "<{$this->_namespacePrefix}:message><![CDATA[";
     $this->appendEscapingCDATA($buf, $event->getRenderedMessage());
     $buf .= "]]></{$this->_namespacePrefix}:message>" . PHP_EOL;
     $ndc = $event->getNDC();
     if ($ndc != null) {
         $buf .= "<{$this->_namespacePrefix}:NDC><![CDATA[";
         $this->appendEscapingCDATA($buf, $ndc);
         $buf .= "]]></{$this->_namespacePrefix}:NDC>" . PHP_EOL;
     }
     if ($this->getLocationInfo()) {
         $locationInfo = $event->getLocationInformation();
         $buf .= "<{$this->_namespacePrefix}:locationInfo " . "class=\"" . $locationInfo->getClassName() . "\" " . "file=\"" . htmlentities($locationInfo->getFileName(), ENT_QUOTES) . "\" " . "line=\"" . $locationInfo->getLineNumber() . "\" " . "method=\"" . $locationInfo->getMethodName() . "\" ";
         $buf .= "/>" . PHP_EOL;
     }
     $buf .= "</{$this->_namespacePrefix}:event>" . PHP_EOL . PHP_EOL;
     return $buf;
 }
开发者ID:bahrmichael,项目名称:eyeos,代码行数:31,代码来源:LoggerLayoutXml.php

示例13: format

 /**
  * @param LoggerLoggingEvent $event
  * @return string
  */
 function format($event)
 {
     $sbuf = LOG4PHP_LINE_SEP . "<tr>" . LOG4PHP_LINE_SEP;
     $sbuf .= "<td>";
     $eventTime = (double) $event->getTimeStamp();
     $eventStartTime = (double) LoggerLoggingEvent::getStartTime();
     $sbuf .= number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
     $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
     $sbuf .= "<td title=\"" . $event->getThreadName() . " thread\">";
     $sbuf .= $event->getThreadName();
     $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
     $sbuf .= "<td title=\"Level\">";
     $level = $event->getLevel();
     if ($level->equals(LoggerLevel::getLevelDebug())) {
         $sbuf .= "<font color=\"#339933\">";
         $sbuf .= $level->toString();
         $sbuf .= "</font>";
     } elseif ($level->equals(LoggerLevel::getLevelWarn())) {
         $sbuf .= "<font color=\"#993300\"><strong>";
         $sbuf .= $level->toString();
         $sbuf .= "</strong></font>";
     } else {
         $sbuf .= $level->toString();
     }
     $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
     $sbuf .= "<td title=\"" . htmlentities($event->getLoggerName(), ENT_QUOTES) . " category\">";
     $sbuf .= htmlentities($event->getLoggerName(), ENT_QUOTES);
     $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
     if ($this->locationInfo) {
         $locInfo = $event->getLocationInformation();
         $sbuf .= "<td>";
         $sbuf .= htmlentities($locInfo->getFileName(), ENT_QUOTES) . ':' . $locInfo->getLineNumber();
         $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
     }
     $sbuf .= "<td title=\"Message\">";
     $sbuf .= htmlentities($event->getRenderedMessage(), ENT_QUOTES);
     $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
     $sbuf .= "</tr>" . LOG4PHP_LINE_SEP;
     if ($event->getNDC() != null) {
         $sbuf .= "<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">";
         $sbuf .= "NDC: " . htmlentities($event->getNDC(), ENT_QUOTES);
         $sbuf .= "</td></tr>" . LOG4PHP_LINE_SEP;
     }
     return $sbuf;
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:49,代码来源:LoggerLayoutHtml.php

示例14: append

 public function append(LoggerLoggingEvent $event)
 {
     if ($this->sp || $this->dry) {
         if ($this->getLocationInfo()) {
             $event->getLocationInformation();
         }
         if (!$this->getUseXml()) {
             $sEvent = serialize($event);
             if (!$this->dry) {
                 fwrite($this->sp, $sEvent, strlen($sEvent));
             } else {
                 echo "DRY MODE OF SOCKET APPENDER: " . $sEvent;
             }
         } else {
             if (!$this->dry) {
                 fwrite($this->sp, $this->xmlLayout->format($event));
             } else {
                 echo "DRY MODE OF SOCKET APPENDER: " . $this->xmlLayout->format($event);
             }
         }
         // not sure about it...
         if (!$this->dry) {
             fflush($this->sp);
         }
     }
 }
开发者ID:sacredwebsite,项目名称:scalr,代码行数:26,代码来源:LoggerAppenderSocket.php

示例15: getEventLocationFields

 /**
  * Returns event location information as array
  * @param LoggerLoggingEvent $event
  * @return array
  */
 public function getEventLocationFields(LoggerLoggingEvent $event)
 {
     $locInfo = $event->getLocationInformation();
     return array('_file' => $locInfo->getFileName(), '_line' => $locInfo->getLineNumber(), '_class' => $locInfo->getClassName(), '_method' => $locInfo->getMethodName());
 }
开发者ID:wikimart,项目名称:log4php-graylog2,代码行数:10,代码来源:LoggerLayoutGelf.php


注:本文中的LoggerLoggingEvent::getLocationInformation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。