[BUGFIX] Rename Log Writer and Processor interface
authorSteffen Müller <typo3@t3node.com>
Fri, 12 Oct 2012 20:04:31 +0000 (22:04 +0200)
committerSteffen Gebert <steffen.gebert@typo3.org>
Sun, 28 Oct 2012 09:52:24 +0000 (10:52 +0100)
Resolves: #41938
Releases: 6.0

Change-Id: I977d9ab1413078adfa1ea46055d389f2f1eaa6f6
Reviewed-on: http://review.typo3.org/15543
Reviewed-by: Steffen Gebert
Tested-by: Steffen Gebert
16 files changed:
typo3/sysext/core/Classes/Log/LogManager.php
typo3/sysext/core/Classes/Log/Logger.php
typo3/sysext/core/Classes/Log/Processor/AbstractProcessor.php
typo3/sysext/core/Classes/Log/Processor/Processor.php [deleted file]
typo3/sysext/core/Classes/Log/Processor/ProcessorInterface.php [new file with mode: 0644]
typo3/sysext/core/Classes/Log/Writer/AbstractWriter.php
typo3/sysext/core/Classes/Log/Writer/DatabaseWriter.php
typo3/sysext/core/Classes/Log/Writer/FileWriter.php
typo3/sysext/core/Classes/Log/Writer/NullWriter.php
typo3/sysext/core/Classes/Log/Writer/PhpErrorLogWriter.php
typo3/sysext/core/Classes/Log/Writer/SyslogWriter.php
typo3/sysext/core/Classes/Log/Writer/Writer.php [deleted file]
typo3/sysext/core/Classes/Log/Writer/WriterInterface.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/Fixtures/WriterFailing.php
typo3/sysext/core/Tests/Unit/Log/LoggerTest.php
typo3/sysext/core/Tests/Unit/Log/Processor/ProcessorTest.php

index e528da4..fcce41d 100644 (file)
@@ -138,7 +138,7 @@ class LogManager implements \TYPO3\CMS\Core\SingletonInterface {
                $configuration = $this->getConfigurationForLogger(self::CONFIGURATION_TYPE_WRITER, $logger->getName());
                foreach ($configuration as $severityLevel => $writer) {
                        foreach ($writer as $logWriterClassName => $logWriterOptions) {
-                               /** @var $logWriter \TYPO3\CMS\Core\Log\Writer\Writer */
+                               /** @var $logWriter \TYPO3\CMS\Core\Log\Writer\WriterInterface */
                                $logWriter = NULL;
                                try {
                                        $logWriter = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($logWriterClassName, $logWriterOptions);
@@ -161,7 +161,7 @@ class LogManager implements \TYPO3\CMS\Core\SingletonInterface {
                $configuration = $this->getConfigurationForLogger(self::CONFIGURATION_TYPE_PROCESSOR, $logger->getName());
                foreach ($configuration as $severityLevel => $processor) {
                        foreach ($processor as $logProcessorClassName => $logProcessorOptions) {
-                               /** @var $logProcessor \TYPO3\CMS\Core\Log\Processor\Processor */
+                               /** @var $logProcessor \TYPO3\CMS\Core\Log\Processor\ProcessorInterface */
                                $logProcessor = NULL;
                                try {
                                        $logProcessor = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($logProcessorClassName, $logProcessorOptions);
@@ -212,4 +212,4 @@ class LogManager implements \TYPO3\CMS\Core\SingletonInterface {
 }
 
 
-?>
\ No newline at end of file
+?>
index e9b648d..ef8692c 100644 (file)
@@ -111,10 +111,10 @@ class Logger {
         * Adds a writer to this logger
         *
         * @param integer $minimumLevel
-        * @param \TYPO3\CMS\Core\Log\Writer\Writer $writer Writer object
+        * @param \TYPO3\CMS\Core\Log\Writer\WriterInterface $writer Writer object
         * @return \TYPO3\CMS\Core\Log\Logger $this
         */
-       public function addWriter($minimumLevel, \TYPO3\CMS\Core\Log\Writer\Writer $writer) {
+       public function addWriter($minimumLevel, \TYPO3\CMS\Core\Log\Writer\WriterInterface $writer) {
                \TYPO3\CMS\Core\Log\LogLevel::validateLevel($minimumLevel);
                // Cycle through all the log levels which are as severe as or higher
                // than $minimumLevel and add $writer to each severity level
@@ -143,10 +143,10 @@ class Logger {
         * Adds a processor to the logger.
         *
         * @param integer $minimumLevel
-        * @param \TYPO3\CMS\Core\Log\Processor\Processor $processor The processor to add.
+        * @param \TYPO3\CMS\Core\Log\Processor\ProcessorInterface $processor The processor to add.
         * @return void
         */
-       public function addProcessor($minimumLevel, \TYPO3\CMS\Core\Log\Processor\Processor $processor) {
+       public function addProcessor($minimumLevel, \TYPO3\CMS\Core\Log\Processor\ProcessorInterface $processor) {
                \TYPO3\CMS\Core\Log\LogLevel::validateLevel($minimumLevel);
                // Cycle through all the log levels which are as severe as or higher
                // than $minimumLevel and add $processor to each severity level
index cbfc755..d782f41 100644 (file)
@@ -30,7 +30,7 @@ namespace TYPO3\CMS\Core\Log\Processor;
  * @package TYPO3
  * @subpackage t3lib
  */
-abstract class AbstractProcessor implements \TYPO3\CMS\Core\Log\Processor\Processor {
+abstract class AbstractProcessor implements \TYPO3\CMS\Core\Log\Processor\ProcessorInterface {
 
        /**
         * Constructs this log processor
diff --git a/typo3/sysext/core/Classes/Log/Processor/Processor.php b/typo3/sysext/core/Classes/Log/Processor/Processor.php
deleted file mode 100644 (file)
index 7b03915..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Log\Processor;
-
-/***************************************************************
- * Copyright notice
- *
- * (c) 2011-2012 Ingo Renner (ingo@typo3.org)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Log processor interface
- *
- * Processors provide additional data in an automatic way, without having to
- * collect that data yourself.
- *
- * @author Ingo Renner <ingo@typo3.org>
- * @package TYPO3
- * @subpackage t3lib
- */
-interface Processor
-{
-       /**
-        * Processes a log record and adds additional data.
-        *
-        * @param \TYPO3\CMS\Core\Log\LogRecord $logRecord The log record to process
-        * @return \TYPO3\CMS\Core\Log\LogRecord The processed log record with additional data
-        */
-       public function processLogRecord(\TYPO3\CMS\Core\Log\LogRecord $logRecord);
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Classes/Log/Processor/ProcessorInterface.php b/typo3/sysext/core/Classes/Log/Processor/ProcessorInterface.php
new file mode 100644 (file)
index 0000000..82e24a3
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+namespace TYPO3\CMS\Core\Log\Processor;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2011-2012 Ingo Renner (ingo@typo3.org)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * Log processor interface
+ *
+ * Processors provide additional data in an automatic way, without having to
+ * collect that data yourself.
+ *
+ * @author Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+interface ProcessorInterface
+{
+       /**
+        * Processes a log record and adds additional data.
+        *
+        * @param \TYPO3\CMS\Core\Log\LogRecord $logRecord The log record to process
+        * @return \TYPO3\CMS\Core\Log\LogRecord The processed log record with additional data
+        */
+       public function processLogRecord(\TYPO3\CMS\Core\Log\LogRecord $logRecord);
+
+}
+
+?>
\ No newline at end of file
index 292f241..ce4ee9d 100644 (file)
@@ -30,7 +30,7 @@ namespace TYPO3\CMS\Core\Log\Writer;
  * @package TYPO3
  * @subpackage t3lib
  */
-abstract class AbstractWriter implements \TYPO3\CMS\Core\Log\Writer\Writer {
+abstract class AbstractWriter implements \TYPO3\CMS\Core\Log\Writer\WriterInterface {
 
        /**
         * Constructs this log writer
index 555510b..ff300cc 100644 (file)
@@ -63,7 +63,7 @@ class DatabaseWriter extends \TYPO3\CMS\Core\Log\Writer\AbstractWriter {
         * Writes the log record
         *
         * @param \TYPO3\CMS\Core\Log\LogRecord $record Log record
-        * @return \TYPO3\CMS\Core\Log\Writer\Writer $this
+        * @return \TYPO3\CMS\Core\Log\Writer\WriterInterface $this
         * @throws \RuntimeException
         */
        public function writeLog(\TYPO3\CMS\Core\Log\LogRecord $record) {
index 8df2756..62feb32 100644 (file)
@@ -83,7 +83,7 @@ class FileWriter extends \TYPO3\CMS\Core\Log\Writer\AbstractWriter {
         * Sets the path to the log file.
         *
         * @param string $logFile path to the log file, relative to PATH_site
-        * @return \TYPO3\CMS\Core\Log\Writer\Writer
+        * @return \TYPO3\CMS\Core\Log\Writer\WriterInterface
         * @throws \InvalidArgumentException
         */
        public function setLogFile($logFile) {
@@ -116,7 +116,7 @@ class FileWriter extends \TYPO3\CMS\Core\Log\Writer\AbstractWriter {
         * Writes the log record
         *
         * @param \TYPO3\CMS\Core\Log\LogRecord $record Log record
-        * @return \TYPO3\CMS\Core\Log\Writer\Writer $this
+        * @return \TYPO3\CMS\Core\Log\Writer\WriterInterface $this
         * @throws \RuntimeException
         */
        public function writeLog(\TYPO3\CMS\Core\Log\LogRecord $record) {
index e298be2..2be2776 100644 (file)
@@ -36,7 +36,7 @@ class NullWriter extends \TYPO3\CMS\Core\Log\Writer\AbstractWriter {
         * Writes the log record
         *
         * @param \TYPO3\CMS\Core\Log\LogRecord $record Log record
-        * @return \TYPO3\CMS\Core\Log\Writer\Writer $this
+        * @return \TYPO3\CMS\Core\Log\Writer\WriterInterface $this
         */
        public function writeLog(\TYPO3\CMS\Core\Log\LogRecord $record) {
                // do nothing
index f24ea73..2f73e3c 100644 (file)
@@ -38,7 +38,7 @@ class PhpErrorLogWriter extends \TYPO3\CMS\Core\Log\Writer\AbstractWriter {
         * Writes the log record
         *
         * @param \TYPO3\CMS\Core\Log\LogRecord $record Log record
-        * @return \TYPO3\CMS\Core\Log\Writer\Writer $this
+        * @return \TYPO3\CMS\Core\Log\Writer\WriterInterface $this
         * @throws \RuntimeException
         */
        public function writeLog(\TYPO3\CMS\Core\Log\LogRecord $record) {
index 4d9a816..a600e8d 100644 (file)
@@ -123,7 +123,7 @@ class SyslogWriter extends \TYPO3\CMS\Core\Log\Writer\AbstractWriter {
         * Writes the log record to syslog
         *
         * @param \TYPO3\CMS\Core\Log\LogRecord $record Log record
-        * @return \TYPO3\CMS\Core\Log\Writer\Writer
+        * @return \TYPO3\CMS\Core\Log\Writer\WriterInterface
         * @throws \RuntimeException
         */
        public function writeLog(\TYPO3\CMS\Core\Log\LogRecord $record) {
diff --git a/typo3/sysext/core/Classes/Log/Writer/Writer.php b/typo3/sysext/core/Classes/Log/Writer/Writer.php
deleted file mode 100644 (file)
index 4b681f9..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Log\Writer;
-
-/***************************************************************
- * Copyright notice
- *
- * (c) 2011-2012 Ingo Renner (ingo@typo3.org)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Log writer interface
- *
- * @author Ingo Renner <ingo@typo3.org>
- * @package TYPO3
- * @subpackage t3lib
- */
-interface Writer
-{
-       /**
-        * Writes the log record
-        *
-        * @param \TYPO3\CMS\Core\Log\LogRecord $record Log record
-        * @return \TYPO3\CMS\Core\Log\Writer\Writer $this
-        * @throws \Exception
-        */
-       public function writeLog(\TYPO3\CMS\Core\Log\LogRecord $record);
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Classes/Log/Writer/WriterInterface.php b/typo3/sysext/core/Classes/Log/Writer/WriterInterface.php
new file mode 100644 (file)
index 0000000..c86dd75
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+namespace TYPO3\CMS\Core\Log\Writer;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2011-2012 Ingo Renner (ingo@typo3.org)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * Log writer interface
+ *
+ * @author Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+interface WriterInterface
+{
+       /**
+        * Writes the log record
+        *
+        * @param \TYPO3\CMS\Core\Log\LogRecord $record Log record
+        * @return \TYPO3\CMS\Core\Log\Writer\WriterInterface $this
+        * @throws \Exception
+        */
+       public function writeLog(\TYPO3\CMS\Core\Log\LogRecord $record);
+
+}
+
+?>
\ No newline at end of file
index be4788c..0ce521d 100644 (file)
@@ -29,13 +29,13 @@ namespace TYPO3\CMS\Core\Tests\Unit\Log\Fixtures;
  *
  * @author Steffen Gebert <steffen.gebert@typo3.org>
  */
-class WriterFailing implements \TYPO3\CMS\Core\Log\Writer\Writer {
+class WriterFailing implements \TYPO3\CMS\Core\Log\Writer\WriterInterface {
 
        /**
         * Try to write the log entry - but throw an exception in our case
         *
         * @param \TYPO3\CMS\Core\Log\LogRecord $record
-        * @return \TYPO3\CMS\Core\Log\Writer\Writer|void
+        * @return \TYPO3\CMS\Core\Log\Writer\WriterInterface|void
         * @throws \RuntimeException
         */
        public function writeLog(\TYPO3\CMS\Core\Log\LogRecord $record) {
index 0e1b426..68f1098 100644 (file)
@@ -97,7 +97,7 @@ class LoggerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $level = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
                $message = 'test';
                $logger = new \TYPO3\CMS\Core\Log\Logger($component);
-               /** @var $processor \TYPO3\CMS\Core\Log\Processor\Processor */
+               /** @var $processor \TYPO3\CMS\Core\Log\Processor\ProcessorInterface */
                $processor = $this->getMock('TYPO3\\CMS\\Core\\Log\\Processor\\NullProcessor', array('processLogRecord'));
                $processor->expects($this->once())->method('processLogRecord')->will($this->returnValue(new \TYPO3\CMS\Core\Log\LogRecord($component, $level, $message)));
                $logger->addProcessor($level, $processor);
index b93c8c4..5eccfe2 100644 (file)
@@ -31,7 +31,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Log\Processor;
  * @package TYPO3
  * @subpackage t3lib
  */
-class ProcessorTest extends \TYPO3\CMS\Core\Tests\UnitTestCase implements \TYPO3\CMS\Core\Log\Processor\Processor {
+class ProcessorTest extends \TYPO3\CMS\Core\Tests\UnitTestCase implements \TYPO3\CMS\Core\Log\Processor\ProcessorInterface {
 
        /**
         * @var bool