本文整理汇总了PHP中LoggerLoggingEvent::getStartTime方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerLoggingEvent::getStartTime方法的具体用法?PHP LoggerLoggingEvent::getStartTime怎么用?PHP LoggerLoggingEvent::getStartTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoggerLoggingEvent
的用法示例。
在下文中一共展示了LoggerLoggingEvent::getStartTime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetStartTime
public function testGetStartTime()
{
$time = LoggerLoggingEvent::getStartTime();
self::assertInternalType('float', $time);
$time2 = LoggerLoggingEvent::getStartTime();
self::assertEquals($time, $time2);
}
示例2: testRelative
public function testRelative()
{
$converter = new LoggerPatternConverterRelative($this->info);
$expected = number_format($this->event->getTimeStamp() - $this->event->getStartTime(), 4);
$actual = $converter->convert($this->event);
self::assertSame($expected, $actual);
}
示例3: convert
/**
* @param LoggerLoggingEvent $event
* @return string
*/
public function convert($event)
{
switch ($this->type) {
case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_RELATIVE_TIME_CONVERTER:
$timeStamp = $event->getTimeStamp();
$startTime = LoggerLoggingEvent::getStartTime();
return (string) (int) ($timeStamp * 1000 - $startTime * 1000);
case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_THREAD_CONVERTER:
return $event->getThreadName();
case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_LEVEL_CONVERTER:
$level = $event->getLevel();
return $level->toString();
case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_NDC_CONVERTER:
return $event->getNDC();
case LoggerPatternParser::LOG4PHP_LOGGER_PATTERN_PARSER_MESSAGE_CONVERTER:
return $event->getRenderedMessage();
default:
return '';
}
}
示例4: getTime
/**
* Returns the time in milliseconds passed from the beginning of execution
* to the time the event was constructed.
*
* @deprecated This method has been replaced by getRelativeTime which
* does not perform unneccesary multiplication and formatting.
*
* @return integer
*/
public function getTime()
{
$eventTime = $this->getTimeStamp();
$eventStartTime = LoggerLoggingEvent::getStartTime();
return number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
}
示例5: 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;
}
示例6: getmypid
{
if ($this->threadName === null) {
$this->threadName = (string) getmypid();
}
return $this->threadName;
}
/**
* @return mixed null
*/
function getThrowableInformation()
{
return null;
}
/**
* Serialize this object
* @return string
*/
function toString()
{
serialize($this);
}
/**
* Avoid serialization of the {@link $logger} object
*/
function __sleep()
{
return array('fqcn', 'categoryName', 'level', 'ndc', 'ndcLookupRequired', 'message', 'renderedMessage', 'threadName', 'timestamp', 'locationInfo');
}
}
LoggerLoggingEvent::getStartTime();