Task #48881

Story #48874: As a developer I want a PSR-3 compatible Logging API

PSR-3: Support log severities of type string

Added by Steffen Müller over 4 years ago. Updated over 4 years ago.

Status:
Resolved
Priority:
Could have
Assignee:
-
Category:
Logging API
Start date:
2013-06-05
Due date:
% Done:

100%

TYPO3 Version:
6.2

Description

PSR-3 LoggerInterface allows "mixed" data type for $severity in log($severity, ...)
It's example implementation uses strings for severity levels.

The actual Logging API in TYPO3 only accepts integers.

Suggestion for a lightweight solution:
If the severity is a string, cast it to an integer in the log() funtion.

if (is_string($level) && defined(TYPO3\CMS\Core\Log\LogLevel . '::'  .strtoupper($level))) {
    $level = constant(TYPO3\CMS\Core\Log\LogLevel . '::' . strtoupper($level));
}

taken from the Monolog Logger

History

#1 Updated by Steffen Müller over 4 years ago

  • Subject changed from PSR-3: Support strings log severities to PSR-3: Support log severities of type string

#2 Updated by Helmut Hummel over 4 years ago

Steffen Müller wrote:

Suggestion for a lightweight solution:
If the severity is a string, cast it to an integer in the log() funtion.

Good one. I would just use it like that.

#3 Updated by Gerrit Code Review over 4 years ago

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21815

#4 Updated by Steffen Müller over 4 years ago

  • Status changed from New to Under Review

#5 Updated by Gerrit Code Review over 4 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21815

#6 Updated by Gerrit Code Review over 4 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21815

#7 Updated by Steffen Müller over 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

applied in changeset c0591ee4

Also available in: Atom PDF