Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.12.8

Request #16124 Add EOL option support for error_log
Submitted: 2009-04-19 17:47 UTC Modified: 2009-05-28 02:38 UTC
From: farell Assigned: jon
Status: Wont fix Package: Log (version 1.11.4)
PHP Version: 5.2.9 OS:
Roadmaps: (Not assigned)    
Subscription  



Patch error_log_1_9.patch Revisions
Revision 2009-04-19 17:48 UTC
Developer farell
 
Download patch

@@ -54,8 +54,15 @@
      * @var string
      * @access private
      */
     var $_timeFormat = '%b %d %H:%M:%S';
+
+    /**
+     * String containing the end-on-line character sequence.
+     * @var string
+     * @access private
+     */
+    var $_eol = "\n";
 
     /**
      * Constructs a new Log_error_log object.
      *
@@ -88,8 +95,14 @@
         }
 
         if (!empty($conf['timeFormat'])) {
             $this->_timeFormat = $conf['timeFormat'];
+        }
+
+        if (!empty($conf['eol'])) {
+            $this->_eol = $conf['eol'];
+        } else {
+            $this->_eol = (strstr(PHP_OS, 'WIN')) ? "\r\n" : "\n";
         }
     }
 
     /**
@@ -145,9 +158,9 @@
 
         /* Build the string containing the complete log line. */
         $line = $this->_format($this->_lineFormat,
                                strftime($this->_timeFormat),
-                               $priority, $message);
+                               $priority, $message) . $this->_eol;
 
         /* Pass the log line and parameters to the error_log() function. */
         $success = error_log($line, $this->_type, $this->_destination,
                              $this->_extra_headers);