Story #48874

As a developer I want a PSR-3 compatible Logging API

Added by Steffen Müller over 4 years ago. Updated about 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 aims to set a standard for Logging in PHP.

Adapting this standard for the Logging API on TYPO3 would allow developers to replace the core Logging implementation with any other PSR-3 compatible logger (given the necessary dependency injection is in place).
It also would ease the understanding how to log in TYPO3.


Subtasks

Task #48876: PSR-3: throw InvalidArgumentException on undefined severityResolved

Task #48877: PSR-3: Cast log message to stringResolved

Task #48879: PSR-3: Validate reserved array key "exception" in LogRecord->dataClosed

Task #48880: Implement LoggerInterface from PSR-3Resolved

Task #48881: PSR-3: Support log severities of type stringResolved


Related issues

Related to Core - Task #49661: Mention PSR-3 Logger compatibility in News.txt Resolved 2013-07-04
Related to TYPO3.Flow - Feature #49039: RFC: Use PSR-3 logger interface in Flow New 2013-06-11

History

#1 Updated by Ernesto Baschny over 4 years ago

In my understanding the major benefit of implementing a PSR-3 compatible interface in TYPO3 is not to "allow developers to replace the core Logging implementation", but to allow third party modules/packages which log to PSR-3 to be integrated into TYPO3 without modification (simply injecting the PSR-3 Logging Interface from TYPO3 into it).

From the Standard:

"The main goal is to allow libraries to receive a Psr\Log\LoggerInterface object and write logs to it in a simple and universal way."

The easiest way would be to provide an adapter which implements this interface and under the hood uses the (more sophisticated) TYPO3 API. TYPO3 Core could still use TYPO3's own API (which provides more flexibility).

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

I don't think we need adapter, since TYPO3\CMS\Core\Log\Logger already meets the requirements of Psr\Log\LoggerInterface (except for some minor glitches as addressed in the subtasks). See #48880 and #48881

#3 Updated by Steffen Müller about 4 years ago

  • Status changed from New to Accepted

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

  • Status changed from Accepted to Resolved

Also available in: Atom PDF