本文整理汇总了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;
}
示例2: convert
public function convert(LoggerLoggingEvent $event)
{
$ts = $event->getRelativeTime();
return number_format($ts, 4);
}