Просмотр исходного кода

Minor code cleanup on Handler/ErrorLogHandler.php (#995)

Just some cleanup for readability.
Westin Shafer 8 лет назад
Родитель
Сommit
443e4a94fc
1 измененных файлов с 7 добавлено и 6 удалено
  1. 7 6
      src/Monolog/Handler/ErrorLogHandler.php

+ 7 - 6
src/Monolog/Handler/ErrorLogHandler.php

@@ -71,13 +71,14 @@ class ErrorLogHandler extends AbstractProcessingHandler
      */
     protected function write(array $record)
     {
-        if ($this->expandNewlines) {
-            $lines = preg_split('{[\r\n]+}', (string) $record['formatted']);
-            foreach ($lines as $line) {
-                error_log($line, $this->messageType);
-            }
-        } else {
+        if (!$this->expandNewlines) {
             error_log((string) $record['formatted'], $this->messageType);
+            return;
+        } 
+        
+        $lines = preg_split('{[\r\n]+}', (string) $record['formatted']);
+        foreach ($lines as $line) {
+            error_log($line, $this->messageType);
         }
     }
 }