You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by gr...@apache.org on 2009/05/20 07:10:08 UTC
svn commit: r776552 - in /incubator/log4php/trunk/src/main/php:
LoggerLoggingEvent.php layouts/LoggerLayoutHtml.php
Author: grobmeier
Date: Wed May 20 05:10:08 2009
New Revision: 776552
URL: http://svn.apache.org/viewvc?rev=776552&view=rev
Log:
moved time calculation from layout to event
Modified:
incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php
incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php
Modified: incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php?rev=776552&r1=776551&r2=776552&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php Wed May 20 05:10:08 2009
@@ -307,6 +307,16 @@
}
/**
+ * Calculates the time of this event.
+ * @return the time after event starttime when this event has occured
+ */
+ public function getTime() {
+ $eventTime = (float)$this->getTimeStamp();
+ $eventStartTime = (float)LoggerLoggingEvent::getStartTime();
+ return number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
+ }
+
+ /**
* @return mixed
*/
public function getThreadName() {
Modified: incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php?rev=776552&r1=776551&r2=776552&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php (original)
+++ incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php Wed May 20 05:10:08 2009
@@ -117,10 +117,7 @@
$sbuf = PHP_EOL . "<tr>" . PHP_EOL;
$sbuf .= "<td>";
-
- $eventTime = (float)$event->getTimeStamp();
- $eventStartTime = (float)LoggerLoggingEvent::getStartTime();
- $sbuf .= number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
+ $sbuf .= $event->getTime();
$sbuf .= "</td>" . PHP_EOL;
$sbuf .= "<td title=\"" . $event->getThreadName() . " thread\">";