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


PHP LoggerLoggingEvent::getRelativeTime方法代码示例

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


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

示例1: format

 /**
  * @param LoggerLoggingEvent $event
  * @return string
  */
 public function format(LoggerLoggingEvent $event)
 {
     $sbuf = PHP_EOL . "<tr>" . PHP_EOL;
     $sbuf .= "<td>";
     $sbuf .= round(1000 * $event->getRelativeTime());
     $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:jjaferson,项目名称:ourives,代码行数:45,代码来源:LoggerLayoutHtml.php

示例2: convert

 public function convert(LoggerLoggingEvent $event)
 {
     $ts = $event->getRelativeTime();
     return number_format($ts, 4);
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:5,代码来源:LoggerPatternConverterRelative.php


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