Skip to content

Commit

Permalink
[TASK] Use PSR-3 LogLevel
Browse files Browse the repository at this point in the history
  • Loading branch information
brotkrueml committed Jul 30, 2023
1 parent edf62f2 commit 3cfcd21
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Documentation/ApiOverview/Deprecation/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ context you can do so in the :file:`config/system/additional.php`:
.. code-block:: php
:caption: config/system/additional.php | typo3conf/system/additional.php
$GLOBALS['TYPO3_CONF_VARS']['LOG']['TYPO3']['CMS']['deprecations']['writerConfiguration'][\TYPO3\CMS\Core\Log\LogLevel::NOTICE] = [];
$GLOBALS['TYPO3_CONF_VARS']['LOG']['TYPO3']['CMS']['deprecations']['writerConfiguration'][\Psr\Log\LogLevel::NOTICE] = [];
*Note:* Due to how the configuration files are being merged, this disabling can only be done in
:file:`config/system/additional.php` and not in :file:`config/system/settings.php`.
Expand Down
6 changes: 3 additions & 3 deletions Documentation/ApiOverview/Logging/Configuration/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The :ref:`log writer <logging-writers>` configuration is read from the sub-key
$GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'] = [
// Configuration for ERROR level log entries
\TYPO3\CMS\Core\Log\LogLevel::ERROR => [
\Psr\Log\LogLevel::ERROR => [
// Add a FileWriter
\TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
// Configuration for the writer
Expand All @@ -62,7 +62,7 @@ use the following configuration:
$GLOBALS['TYPO3_CONF_VARS']['LOG']['T3docs']['Examples']['Controller']['writerConfiguration'] = [
// Configuration for WARNING severity, including all
// levels with higher severity (ERROR, CRITICAL, EMERGENCY)
\TYPO3\CMS\Core\Log\LogLevel::WARNING => [
\Psr\Log\LogLevel::WARNING => [
// Add a SyslogWriter
\TYPO3\CMS\Core\Log\Writer\SyslogWriter::class => [],
],
Expand Down Expand Up @@ -129,7 +129,7 @@ can be configured on a per-class and per-namespace basis with the sub-key
$GLOBALS['TYPO3_CONF_VARS']['LOG']['T3docs']['Examples']['Controller']['processorConfiguration'] = [
// Configuration for ERROR level log entries
\TYPO3\CMS\Core\Log\LogLevel::ERROR => [
\Psr\Log\LogLevel::ERROR => [
// Add a MemoryUsageProcessor
\TYPO3\CMS\Core\Log\Processor\MemoryUsageProcessor::class => [
'formatSize' => TRUE
Expand Down
18 changes: 9 additions & 9 deletions Documentation/ApiOverview/Logging/Logger/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ For each of the severity levels mentioned below, a shorthand method exists in
.. _label-Debug:
.. option:: Debug

:Class constant: :php:`\TYPO3\CMS\Core\Log\LogLevel::DEBUG`
:Class constant: :php:`\Psr\Log\LogLevel::DEBUG`
:Shorthand method: :php:`$this->logger->debug($message, $context);`

For debug information: give detailed status information during the
Expand All @@ -115,7 +115,7 @@ For each of the severity levels mentioned below, a shorthand method exists in
.. _label-Informational:
.. option:: Informational

:Class constant: :php:`\TYPO3\CMS\Core\Log\LogLevel::INFO`
:Class constant: :php:`\Psr\Log\LogLevel::INFO`
:Shorthand method: :php:`$this->logger->info($message, $context);`

For informational messages, some examples:
Expand All @@ -127,7 +127,7 @@ For each of the severity levels mentioned below, a shorthand method exists in
.. _label-notice:
.. option:: Notice

:Class constant: :php:`\TYPO3\CMS\Core\Log\LogLevel::NOTICE`
:Class constant: :php:`\Psr\Log\LogLevel::NOTICE`
:Shorthand method: :php:`$this->logger->notice($message, $context);`

For significant conditions. Things you should have a look at, nothing to
Expand All @@ -139,7 +139,7 @@ For each of the severity levels mentioned below, a shorthand method exists in
.. _label-warning:
.. option:: Warning

:Class constant: :php:`\TYPO3\CMS\Core\Log\LogLevel::WARNING`
:Class constant: :php:`\Psr\Log\LogLevel::WARNING`
:Shorthand method: :php:`$this->logger->warning($message, $context);`

For warning conditions. Some examples:
Expand All @@ -150,7 +150,7 @@ For each of the severity levels mentioned below, a shorthand method exists in
.. _label-error:
.. option:: Error

:Class constant: :php:`\TYPO3\CMS\Core\Log\LogLevel::ERROR`
:Class constant: :php:`\Psr\Log\LogLevel::ERROR`
:Shorthand method: :php:`$this->logger->error($message, $context);`

For error conditions. Some examples:
Expand All @@ -162,7 +162,7 @@ For each of the severity levels mentioned below, a shorthand method exists in
.. _label-critical:
.. option:: Critical

:Class constant: :php:`\TYPO3\CMS\Core\Log\LogLevel::CRITICAL`
:Class constant: :php:`\Psr\Log\LogLevel::CRITICAL`
:Shorthand method: :php:`$this->logger->critical($message, $context);`

For critical conditions. Some examples:
Expand All @@ -174,7 +174,7 @@ For each of the severity levels mentioned below, a shorthand method exists in
.. _label-alert:
.. option:: Alert

:Class constant: :php:`\TYPO3\CMS\Core\Log\LogLevel::ALERT`
:Class constant: :php:`\Psr\Log\LogLevel::ALERT`
:Shorthand method: :php:`$this->logger->alert($message, $context);`

For blocking conditions, action must be taken immediately. Some examples:
Expand All @@ -185,7 +185,7 @@ For each of the severity levels mentioned below, a shorthand method exists in
.. _label-emergency:
.. option:: Emergency

:Class constant: :php:`\TYPO3\CMS\Core\Log\LogLevel::EMERGENCY`
:Class constant: :php:`\Psr\Log\LogLevel::EMERGENCY`
:Shorthand method: :php:`$this->logger->emergency($message, $context);`

Nothing works, the system is unusable. You will likely not be able to reach
Expand Down Expand Up @@ -241,8 +241,8 @@ The channel "security" can then be used in the logging configuration:
.. code-block:: php
:caption: config/system/additional.php | typo3conf/system/additional.php
use Psr\Log\LogLevel;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Log\LogLevel;
use TYPO3\CMS\Core\Log\Writer\FileWriter;
$GLOBALS['TYPO3_CONF_VARS']['LOG']['security']['writerConfiguration'] = [
Expand Down
2 changes: 1 addition & 1 deletion Documentation/ApiOverview/Logging/Model/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ component

level
An integer severity level from
:ref:`\\TYPO3\\CMS\\Core\\Log\\LogLevel <logging-logger-log>`.
:ref:`\\Psr\\Log\\LogLevel <logging-logger-log>`.

message
The log message string.
Expand Down
2 changes: 1 addition & 1 deletion Documentation/ApiOverview/Logging/Quickstart/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ specifying an invalid value) should use placeholders, denoted by
.. code-block:: php
:caption: EXT:my_extension/Classes/MyClass.php
// use TYPO3\CMS\Core\Log\LogLevel;
// use Psr\Log\LogLevel;
$this->logger->log(LogLevel::CRITICAL, 'This is an utter failure!');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Example logging configuration:
:caption: config/system/additional.php | typo3conf/system/additional.php
$GLOBALS['TYPO3_CONF_VARS']['LOG']['TYPO3']['CMS']['Core']['Authentication']['writerConfiguration'] = [
\TYPO3\CMS\Core\Log\LogLevel::INFO => [
\Psr\Log\LogLevel::INFO => [
\TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
'logFile' => \TYPO3\CMS\Core\Core\Environment::getVarPath() . '/log/typo3_auth.log',
]
Expand Down

0 comments on commit 3cfcd21

Please sign in to comment.