From ff5bbbbb74dc5424e61f3d1f239fc30b168e1dcb Mon Sep 17 00:00:00 2001 From: Francois Suter Date: Wed, 28 Aug 2019 14:31:46 +0200 Subject: [PATCH] [TASK] Merge code variants from different projects, set TYPO3 8 as requirement, clean up code --- Classes/Log/Logger.php | 59 +++++++++++------- Classes/Log/Writer/LogEntries.php | 31 ++++++--- README.md | 15 +++-- .../{ExtensionIcon.svg => Extension.svg} | 0 Resources/Public/Icons/relation.gif | Bin 233 -> 0 bytes ext_emconf.php | 58 +++++++++-------- ext_icon.png | Bin 990 -> 0 bytes ext_localconf.php | 21 ++++--- 8 files changed, 103 insertions(+), 81 deletions(-) rename Resources/Public/Icons/{ExtensionIcon.svg => Extension.svg} (100%) delete mode 100755 Resources/Public/Icons/relation.gif delete mode 100644 ext_icon.png diff --git a/Classes/Log/Logger.php b/Classes/Log/Logger.php index 0e0aa92..f1f032a 100755 --- a/Classes/Log/Logger.php +++ b/Classes/Log/Logger.php @@ -1,18 +1,29 @@ * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * All rights reserved * - * The TYPO3 project - inspiring people to share! - */ + * 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! + ***************************************************************/ use TYPO3\CMS\Core\Log\LogManager; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -30,7 +41,7 @@ class Logger * @param string $message * @return string */ - static public function emergency($process, $message) + public static function emergency($process, $message) { /** @var \TYPO3\CMS\Core\Log\Logger $logger */ $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); @@ -42,98 +53,98 @@ static public function emergency($process, $message) /** * Sends a critical log to logentries + * @param string $process Process related to this log * @param string $message * @return string */ - static public function critical($process, $message) + public static function critical($process, $message) { /** @var \TYPO3\CMS\Core\Log\Logger $logger */ $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); - // Write to Log $logger->critical($process . ' - ' . $message); return $message; } /** * Sends an alert log to logentries + * @param string $process Process related to this log * @param string $message * @return string */ - static public function alert($process, $message) + public static function alert($process, $message) { /** @var \TYPO3\CMS\Core\Log\Logger $logger */ $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); - // Write to Log $logger->alert($process . ' - ' . $message); return $message; } /** * Sends an error log to logentries + * @param string $process Process related to this log * @param string $message * @return string */ - static public function error($process, $message) + public static function error($process, $message) { /** @var \TYPO3\CMS\Core\Log\Logger $logger */ $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); - // Write to Log $logger->error($process . ' - ' . $message); return $message; } /** * Sends a warning log to logentries + * @param string $process Process related to this log * @param string $message * @return string */ - static public function warning($process, $message) + public static function warning($process, $message) { /** @var \TYPO3\CMS\Core\Log\Logger $logger */ $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); - // Write to Log $logger->warning($process . ' - ' . $message); return $message; } /** * Sends a notice log to logentries + * @param string $process Process related to this log * @param string $message * @return string */ - static public function notice($process, $message) + public static function notice($process, $message) { /** @var \TYPO3\CMS\Core\Log\Logger $logger */ $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); - // Write to Log $logger->notice($process . ' - ' . $message); return $message; } /** * Sends an info log to logentries + * @param string $process Process related to this log * @param string $message * @return string */ - static public function info($process, $message) + public static function info($process, $message) { /** @var \TYPO3\CMS\Core\Log\Logger $logger */ $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); - // Write to Log $logger->info($process . ' - ' . $message); return $message; } /** * Sends a debug log to logentries + * @param string $process Process related to this log * @param string $message * @return string */ - static public function debug($process, $message) + public static function debug($process, $message) { /** @var \TYPO3\CMS\Core\Log\Logger $logger */ $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); - // Write to Log $logger->debug($process . ' - ' . $message); return $message; } diff --git a/Classes/Log/Writer/LogEntries.php b/Classes/Log/Writer/LogEntries.php index 8d7fa3b..a337ad7 100755 --- a/Classes/Log/Writer/LogEntries.php +++ b/Classes/Log/Writer/LogEntries.php @@ -1,18 +1,30 @@ * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. + * All rights reserved * - * The TYPO3 project - inspiring people to share! - */ + * 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! + ***************************************************************/ use TYPO3\CMS\Core\Log\LogRecord; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; @@ -20,6 +32,7 @@ /** * Sends log messages to Logentries.com + * */ class LogEntries extends \TYPO3\CMS\Core\Log\Writer\AbstractWriter { diff --git a/README.md b/README.md index 3bd06c1..2d4c9d3 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,13 @@ makes it possible to use it with the TYPO3 logging framework. Example: ``` -$GLOBALS['TYPO3_CONF_VARS']['LOG']['Cobweb']['LogEntries']['Log']['Logger'] = array( - 'writerConfiguration' => array( - \TYPO3\CMS\Core\Log\LogLevel::DEBUG => array( - 'Cobweb\\LogEntries\\Log\\Writer\\LogEntries' => array( - ) - ), - ) -); +$GLOBALS['TYPO3_CONF_VARS']['LOG']['Cobweb']['LogEntries']['Log']['Logger'] = [ + 'writerConfiguration' => [ + \TYPO3\CMS\Core\Log\LogLevel::DEBUG => [ + 'Cobweb\\LogEntries\\Log\\Writer\\LogEntries' => [] + ], + ] +]; ``` The extension also provides some static methods for quickly writing to Logentries: diff --git a/Resources/Public/Icons/ExtensionIcon.svg b/Resources/Public/Icons/Extension.svg similarity index 100% rename from Resources/Public/Icons/ExtensionIcon.svg rename to Resources/Public/Icons/Extension.svg diff --git a/Resources/Public/Icons/relation.gif b/Resources/Public/Icons/relation.gif deleted file mode 100755 index db61d7e18817e2969b740ccc62838a1447cd3c3c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 233 zcmZ?wbh9u|6krfwIKsfd$jB%yEgcvb*xK4Ud-m+*V6c9}`t4wF3=FP=!D}%14h9TB zki(G3kjIe9P{N?kkO3r981fmC8H$0t6rgAskS<}UWKjIc!pOiN#GnJx0zsgJEBshvI<>Lne0l)en}fzWvHFt6ysaM@@~DQbVIgvycNT2L~5d538f; 'LogEntries logger', - 'description' => 'Provides a logger that sends data to LogEntries.com', - 'category' => 'services', - 'author' => 'Julien Henchoz', - 'author_email' => 'typo3@cobweb.ch', - 'author_company' => 'Cobweb Development SARL', - 'shy' => '', - 'priority' => '', - 'module' => '', - 'state' => 'stable', - 'internal' => '', - 'uploadfolder' => '0', - 'createDirs' => '', - 'modify_tables' => '', - 'clearCacheOnLoad' => 0, - 'lockType' => '', - 'version' => '1.1.0', - 'constraints' => array( - 'depends' => array( - 'typo3' => '7.6.0-7.6.99', - ), - 'conflicts' => array( - ), - 'suggests' => array( - ), - ), -); - -?> +$EM_CONF[$_EXTKEY] = [ + 'title' => 'LogEntries logger', + 'description' => 'Provides a logger that sends data to LogEntries.com', + 'category' => 'services', + 'author' => 'Julien Henchoz', + 'author_email' => 'typo3@ideative.ch', + 'author_company' => 'Idéative', + 'shy' => '', + 'priority' => '', + 'module' => '', + 'state' => 'stable', + 'internal' => '', + 'uploadfolder' => '0', + 'createDirs' => '', + 'modify_tables' => '', + 'clearCacheOnLoad' => 0, + 'lockType' => '', + 'version' => '1.1.0', + 'constraints' => [ + 'depends' => [ + 'typo3' => '8.7.0-8.7.99', + ], + 'conflicts' => [ + ], + 'suggests' => [ + ], + ], +]; diff --git a/ext_icon.png b/ext_icon.png deleted file mode 100644 index df2a78f485575e2d899f19fd54c6eb23ce9f8520..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 990 zcmV<410np0P)2FL?6u_Tii#ylnj-dP+ES#}l157^ ztu9C@nyRJ^?R4HUZ<#mmz2n_0BlFCCGq25bPI59Yxo6J#-Fwfu=Uxf`D35Av&tR$S z8)cp$HrkWkV+?vcFNVZ z^#%a>P4T*c4*b8mUfbTCA1-LUone$%ax^E@!96P4vhye|YhJCX zQS1nCo{IzVaRCUn9AI|M2t2do@%Wd`Sqxm>3ct2&#+(L<**57nX^`0+4a(1E@D@#$ zzCgRss<~C_UyE zKzww@*I|4(XqpDhfkg%YrKJvU1%GL$bpVurD4B>kfP=*NZb8FyJg&5U07ptR*w>5# z{z?X@Ob@uK?gD#oj&%TBqh%+_%U^S!TmkuOK)7=l=Yqlh-9z(|^#|aH8wF}_mvQ#8 z2uxa(|HI|cS-eW@p#|WoE(YnvrG5e+XZQ0B0MfIffCmw(dnSEmU^^=S+_9Ag05*52 zCC64ZAOKoMZy_b$fC4xRlMMjQ!j#Yg$W1Q|0H`;hL&vXU{XB3M#Dj3}gkFYw{xzpQ z18~Pzk<0LHDejV_`0UeC#!s z0NjbyDVw;?f5(qKh5;En;B{Vu{19mydI~6#Nyl|Aq%d* zh)_�IW)DeH4E_;SQ4&=?MCgCq>YF!4{kHy)N22<{tn60RR6308=|L&i~n(jsO4v M07*qoM6N<$f-W!0kpKVy diff --git a/ext_localconf.php b/ext_localconf.php index 1ddd355..60cd9f8 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,15 +1,16 @@ array( - \TYPO3\CMS\Core\Log\LogLevel::DEBUG => array( - \Cobweb\LogEntries\Log\Writer\LogEntries::class => array() - ), - ) -); +$GLOBALS['TYPO3_CONF_VARS']['LOG']['Cobweb']['LogEntries']['Log']['Logger'] = [ + 'writerConfiguration' => [ + \TYPO3\CMS\Core\Log\LogLevel::DEBUG => [ + \Cobweb\LogEntries\Log\Writer\LogEntries::class => [ + ] + ], + ] +];