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


PHP LoggerLoggingEvent::getMDCMap方法代码示例

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


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

示例1: convert

 public function convert(LoggerLoggingEvent $event)
 {
     if (isset($this->key)) {
         return $event->getMDC($this->key);
     } else {
         $buff = array();
         $map = $event->getMDCMap();
         foreach ($map as $key => $value) {
             $buff[] = "{$key}={$value}";
         }
         return implode(', ', $buff);
     }
 }
开发者ID:gustavoghioldi,项目名称:Plugin-opencart2,代码行数:13,代码来源:LoggerPatternConverterMDC.php

示例2: 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

示例3: getEventMDCFields

 /**
  * Returns event MDC data as array
  * @param LoggerLoggingEvent $event
  * @return array
  */
 public function getEventMDCFields(LoggerLoggingEvent $event)
 {
     $fields = array();
     foreach ($event->getMDCMap() as $key => $value) {
         $fieldName = "_" . $key;
         if ($this->isAdditionalFieldNameValid($fieldName)) {
             $fields[$fieldName] = $value;
         }
     }
     return $fields;
 }
开发者ID:wikimart,项目名称:log4php-graylog2,代码行数:16,代码来源:LoggerLayoutGelf.php


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