ソースを参照

Remove deprecated log formatter options

Corey Taylor 4 年 前
コミット
768830241d

+ 0 - 5
src/Log/Engine/ConsoleLog.php

@@ -78,11 +78,6 @@ class ConsoleLog extends BaseLog
         if (isset($config['outputAs'])) {
             $this->_output->setOutputAs($config['outputAs']);
         }
-
-        if (isset($this->_config['dateFormat'])) {
-            deprecationWarning('`dateFormat` option should now be set in the formatter options.');
-            $this->formatter->setConfig('dateFormat', $this->_config['dateFormat']);
-        }
     }
 
     /**

+ 0 - 6
src/Log/Engine/FileLog.php

@@ -41,7 +41,6 @@ class FileLog extends BaseLog
      *   If value is 0, old versions are removed rather then rotated.
      * - `mask` A mask is applied when log files are created. Left empty no chmod
      *   is made.
-     * - `dateFormat` PHP date() format.
      *
      * @var array
      */
@@ -108,11 +107,6 @@ class FileLog extends BaseLog
                 $this->_size = Text::parseFileSize($this->_config['size']);
             }
         }
-
-        if (isset($this->_config['dateFormat'])) {
-            deprecationWarning('`dateFormat` option should now be set in the formatter options.');
-            $this->formatter->setConfig('dateFormat', $this->_config['dateFormat']);
-        }
     }
 
     /**

+ 0 - 20
tests/TestCase/Log/Engine/ConsoleLogTest.php

@@ -122,24 +122,4 @@ class ConsoleLogTest extends TestCase
         $this->assertSame('error', $entry['level']);
         $this->assertSame('oh "noes"', $entry['message']);
     }
-
-    /**
-     * Test deprecated dateFormat option
-     *
-     * @return void
-     */
-    public function testDeprecatedDateFormat()
-    {
-        $this->deprecated(function () {
-            $filename = tempnam(sys_get_temp_dir(), 'cake_log_test');
-            $log = new ConsoleLog([
-                'stream' => $filename,
-                'dateFormat' => 'c',
-            ]);
-            $log->log('error', 'oh noes');
-            $fh = fopen($filename, 'r');
-            $line = fgets($fh);
-            $this->assertMatchesRegularExpression('/2[0-9]{3}-[0-9]+-[0-9]+T[0-9]+:[0-9]+:[0-9]+\+\d{2}:\d{2} error: oh noes/', $line);
-        });
-    }
 }

+ 0 - 18
tests/TestCase/Log/Engine/FileLogTest.php

@@ -215,22 +215,4 @@ class FileLogTest extends TestCase
         $result = file_get_contents(LOGS . 'error.log');
         $this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+T[0-9]+:[0-9]+:[0-9]+\+\d{2}:\d{2} warning: Test warning/', $result);
     }
-
-    /**
-     * Test deprecated dateFormat option
-     *
-     * @return void
-     */
-    public function testDeprecatedDateFormat()
-    {
-        $this->deprecated(function () {
-            $this->_deleteLogs(LOGS);
-
-            $log = new FileLog(['path' => LOGS, 'dateFormat' => 'c']);
-            $log->log('warning', 'Test warning');
-
-            $result = file_get_contents(LOGS . 'error.log');
-            $this->assertMatchesRegularExpression('/^2[0-9]{3}-[0-9]+-[0-9]+T[0-9]+:[0-9]+:[0-9]+\+\d{2}:\d{2} warning: Test warning/', $result);
-        });
-    }
 }