Author: kurdalen
Date: Sun May  3 09:09:11 2009
New Revision: 771043

URL: http://svn.apache.org/viewvc?rev=771043&view=rev
Log:
fixed #LOG4PHP-35

Modified:
    incubator/log4php/trunk/src/main/php/helpers/LoggerPatternParser.php
    incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php
    incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php
    incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php

Modified: incubator/log4php/trunk/src/main/php/helpers/LoggerPatternParser.php
URL: 
http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/helpers/LoggerPatternParser.php?rev=771043&r1=771042&r2=771043&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/helpers/LoggerPatternParser.php 
(original)
+++ incubator/log4php/trunk/src/main/php/helpers/LoggerPatternParser.php Sun 
May  3 09:09:11 2009
@@ -20,20 +20,6 @@
  * @subpackage helpers
  */
 
-if (!defined('LOG4PHP_LINE_SEP')) {
-    if (substr(php_uname(), 0, 7) == "Windows") {
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_LINE_SEP', "\r\n");
-    } else {
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_LINE_SEP', "\n");
-    }
-}
-
 define('LOG4PHP_LOGGER_PATTERN_PARSER_ESCAPE_CHAR',         '%');
 
 define('LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE',       0);
@@ -197,7 +183,7 @@
                                 break;
                             case 'n':
                                 // 
LoggerLog::debug("LoggerPatternParser::parse() next char is 'n'");              
              
-                                $this->currentLiteral .= LOG4PHP_LINE_SEP;
+                                $this->currentLiteral .= PHP_EOL;
                                 $this->i++; // move pointer
                                 break;
                             default:

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=771043&r1=771042&r2=771043&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php (original)
+++ incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php Sun May  
3 09:09:11 2009
@@ -20,20 +20,6 @@
  * @subpackage layouts
  */
 
-if (!defined('LOG4PHP_LINE_SEP')) {
-    if (substr(php_uname(), 0, 7) == "Windows") { 
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_LINE_SEP', "\r\n");
-    } else {
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_LINE_SEP', "\n");
-    }
-}
-
 /**
  * This layout outputs events in a HTML table.
  *
@@ -143,18 +129,18 @@
      */
     function format($event)
     {
-        $sbuf = LOG4PHP_LINE_SEP . "<tr>" . LOG4PHP_LINE_SEP;
+        $sbuf = PHP_EOL . "<tr>" . PHP_EOL;
     
         $sbuf .= "<td>";
         
         $eventTime = (float)$event->getTimeStamp();
         $eventStartTime = (float)LoggerLoggingEvent::getStartTime();
         $sbuf .= number_format(($eventTime - $eventStartTime) * 1000, 0, '', 
'');
-        $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
+        $sbuf .= "</td>" . PHP_EOL;
     
         $sbuf .= "<td title=\"" . $event->getThreadName() . " thread\">";
         $sbuf .= $event->getThreadName();
-        $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
+        $sbuf .= "</td>" . PHP_EOL;
     
         $sbuf .= "<td title=\"Level\">";
         
@@ -171,29 +157,29 @@
         } else {
           $sbuf .= $level->toString();
         }
-        $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
+        $sbuf .= "</td>" . PHP_EOL;
     
         $sbuf .= "<td title=\"" . htmlentities($event->getLoggerName(), 
ENT_QUOTES) . " category\">";
         $sbuf .= htmlentities($event->getLoggerName(), ENT_QUOTES);
-        $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
+        $sbuf .= "</td>" . PHP_EOL;
     
         if ($this->locationInfo) {
             $locInfo = $event->getLocationInformation();
             $sbuf .= "<td>";
             $sbuf .= htmlentities($locInfo->getFileName(), ENT_QUOTES). ':' . 
$locInfo->getLineNumber();
-            $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
+            $sbuf .= "</td>" . PHP_EOL;
         }
 
         $sbuf .= "<td title=\"Message\">";
         $sbuf .= htmlentities($event->getRenderedMessage(), ENT_QUOTES);
-        $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
+        $sbuf .= "</td>" . PHP_EOL;
 
-        $sbuf .= "</tr>" . LOG4PHP_LINE_SEP;
+        $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>" . LOG4PHP_LINE_SEP;
+            $sbuf .= "</td></tr>" . PHP_EOL;
         }
 
         return $sbuf;
@@ -204,31 +190,31 @@
      */
     function getHeader()
     {
-        $sbuf = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 
Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\";>" . 
LOG4PHP_LINE_SEP;
-        $sbuf .= "<html>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<head>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<title>" . $this->title . "</title>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<style type=\"text/css\">" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<!--" . LOG4PHP_LINE_SEP;
-        $sbuf .= "body, table {font-family: arial,sans-serif; font-size: 
x-small;}" . LOG4PHP_LINE_SEP;
-        $sbuf .= "th {background: #336699; color: #FFFFFF; text-align: left;}" 
. LOG4PHP_LINE_SEP;
-        $sbuf .= "-->" . LOG4PHP_LINE_SEP;
-        $sbuf .= "</style>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "</head>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<body bgcolor=\"#FFFFFF\" topmargin=\"6\" leftmargin=\"6\">" 
. LOG4PHP_LINE_SEP;
-        $sbuf .= "<hr size=\"1\" noshade>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "Log session start time " . strftime('%c', time()) . "<br>" . 
LOG4PHP_LINE_SEP;
-        $sbuf .= "<br>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<table cellspacing=\"0\" cellpadding=\"4\" border=\"1\" 
bordercolor=\"#224466\" width=\"100%\">" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<tr>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<th>Time</th>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<th>Thread</th>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<th>Level</th>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<th>Category</th>" . LOG4PHP_LINE_SEP;
+        $sbuf = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 
Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\";>" . PHP_EOL;
+        $sbuf .= "<html>" . PHP_EOL;
+        $sbuf .= "<head>" . PHP_EOL;
+        $sbuf .= "<title>" . $this->title . "</title>" . PHP_EOL;
+        $sbuf .= "<style type=\"text/css\">" . PHP_EOL;
+        $sbuf .= "<!--" . PHP_EOL;
+        $sbuf .= "body, table {font-family: arial,sans-serif; font-size: 
x-small;}" . PHP_EOL;
+        $sbuf .= "th {background: #336699; color: #FFFFFF; text-align: left;}" 
. PHP_EOL;
+        $sbuf .= "-->" . PHP_EOL;
+        $sbuf .= "</style>" . PHP_EOL;
+        $sbuf .= "</head>" . PHP_EOL;
+        $sbuf .= "<body bgcolor=\"#FFFFFF\" topmargin=\"6\" leftmargin=\"6\">" 
. PHP_EOL;
+        $sbuf .= "<hr size=\"1\" noshade>" . PHP_EOL;
+        $sbuf .= "Log session start time " . strftime('%c', time()) . "<br>" . 
PHP_EOL;
+        $sbuf .= "<br>" . PHP_EOL;
+        $sbuf .= "<table cellspacing=\"0\" cellpadding=\"4\" border=\"1\" 
bordercolor=\"#224466\" width=\"100%\">" . PHP_EOL;
+        $sbuf .= "<tr>" . PHP_EOL;
+        $sbuf .= "<th>Time</th>" . PHP_EOL;
+        $sbuf .= "<th>Thread</th>" . PHP_EOL;
+        $sbuf .= "<th>Level</th>" . PHP_EOL;
+        $sbuf .= "<th>Category</th>" . PHP_EOL;
         if ($this->locationInfo)
-            $sbuf .= "<th>File:Line</th>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<th>Message</th>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "</tr>" . LOG4PHP_LINE_SEP;
+            $sbuf .= "<th>File:Line</th>" . PHP_EOL;
+        $sbuf .= "<th>Message</th>" . PHP_EOL;
+        $sbuf .= "</tr>" . PHP_EOL;
 
         return $sbuf;
     }
@@ -238,8 +224,8 @@
      */
     function getFooter()
     {
-        $sbuf = "</table>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<br>" . LOG4PHP_LINE_SEP;
+        $sbuf = "</table>" . PHP_EOL;
+        $sbuf .= "<br>" . PHP_EOL;
         $sbuf .= "</body></html>";
 
         return $sbuf;

Modified: incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php
URL: 
http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php?rev=771043&r1=771042&r2=771043&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php 
(original)
+++ incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php Sun May 
 3 09:09:11 2009
@@ -20,17 +20,6 @@
  * @subpackage layouts
  */
 
-if (!defined('LOG4PHP_LINE_SEP')) {
-    if (substr(php_uname(), 0, 7) == "Windows") { 
-        define('LOG4PHP_LINE_SEP', "\r\n");
-    } else {
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_LINE_SEP', "\n");
-    }
-}
-
 /**
  * A simple layout.
  *
@@ -70,6 +59,6 @@
     function format($event)
     {
         $level = $event->getLevel();
-        return $level->toString() . ' - ' . $event->getRenderedMessage(). 
LOG4PHP_LINE_SEP;
+        return $level->toString() . ' - ' . $event->getRenderedMessage(). 
PHP_EOL;
     }
 }

Modified: incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php
URL: 
http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php?rev=771043&r1=771042&r2=771043&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php (original)
+++ incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php Sun May  
3 09:09:11 2009
@@ -20,20 +20,6 @@
  * @subpackage layouts
  */
 
-if (!defined('LOG4PHP_LINE_SEP')) {
-    if (substr(php_uname(), 0, 7) == "Windows") { 
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_LINE_SEP', "\r\n");
-    } else {
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_LINE_SEP', "\n");
-    }
-}
-
 /**
  * String constant designating no time information. Current value of
  * this constant is <b>NULL</b>.
@@ -224,7 +210,7 @@
         }
         
         $format .= '- '.$event->getRenderedMessage();
-        $format .= LOG4PHP_LINE_SEP;
+        $format .= PHP_EOL;
         
         return $format;
     }


Reply via email to