Merge branch 'MDL-82971_upgrade-log' of https://github.com/ziegenberg/moodle

This commit is contained in:
Sara Arjona 2024-09-18 17:10:12 +02:00
commit 20d4b14ee0
No known key found for this signature in database
7 changed files with 14 additions and 87 deletions

View File

@ -0,0 +1,10 @@
# PSR-3 Log
This is a description for including the PSR-3 Interfaces in Moodle
## Installation
1. Visit https://github.com/php-fig/log
2. Download the latest release
3. Unzip in this folder
4. Update `thirdpartylibs.xml`

View File

@ -9,10 +9,6 @@ interface LoggerAwareInterface
{
/**
* Sets a logger instance on the object.
*
* @param LoggerInterface $logger
*
* @return void
*/
public function setLogger(LoggerInterface $logger): void;
}

View File

@ -9,15 +9,11 @@ trait LoggerAwareTrait
{
/**
* The logger instance.
*
* @var LoggerInterface|null
*/
protected ?LoggerInterface $logger = null;
/**
* Sets a logger.
*
* @param LoggerInterface $logger
*/
public function setLogger(LoggerInterface $logger): void
{

View File

@ -22,10 +22,7 @@ interface LoggerInterface
/**
* System is unusable.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function emergency(string|\Stringable $message, array $context = []): void;
@ -35,10 +32,7 @@ interface LoggerInterface
* Example: Entire website down, database unavailable, etc. This should
* trigger the SMS alerts and wake you up.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function alert(string|\Stringable $message, array $context = []): void;
@ -47,10 +41,7 @@ interface LoggerInterface
*
* Example: Application component unavailable, unexpected exception.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function critical(string|\Stringable $message, array $context = []): void;
@ -58,10 +49,7 @@ interface LoggerInterface
* Runtime errors that do not require immediate action but should typically
* be logged and monitored.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function error(string|\Stringable $message, array $context = []): void;
@ -71,20 +59,14 @@ interface LoggerInterface
* Example: Use of deprecated APIs, poor use of an API, undesirable things
* that are not necessarily wrong.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function warning(string|\Stringable $message, array $context = []): void;
/**
* Normal but significant events.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function notice(string|\Stringable $message, array $context = []): void;
@ -93,32 +75,23 @@ interface LoggerInterface
*
* Example: User logs in, SQL logs.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function info(string|\Stringable $message, array $context = []): void;
/**
* Detailed debug information.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function debug(string|\Stringable $message, array $context = []): void;
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string|\Stringable $message
* @param mixed $level
* @param mixed[] $context
*
* @return void
*
* @throws \Psr\Log\InvalidArgumentException
*/
public function log($level, string|\Stringable $message, array $context = []): void;

View File

@ -14,11 +14,6 @@ trait LoggerTrait
{
/**
* System is unusable.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function emergency(string|\Stringable $message, array $context = []): void
{
@ -30,11 +25,6 @@ trait LoggerTrait
*
* Example: Entire website down, database unavailable, etc. This should
* trigger the SMS alerts and wake you up.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function alert(string|\Stringable $message, array $context = []): void
{
@ -45,11 +35,6 @@ trait LoggerTrait
* Critical conditions.
*
* Example: Application component unavailable, unexpected exception.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function critical(string|\Stringable $message, array $context = []): void
{
@ -59,11 +44,6 @@ trait LoggerTrait
/**
* Runtime errors that do not require immediate action but should typically
* be logged and monitored.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function error(string|\Stringable $message, array $context = []): void
{
@ -75,11 +55,6 @@ trait LoggerTrait
*
* Example: Use of deprecated APIs, poor use of an API, undesirable things
* that are not necessarily wrong.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function warning(string|\Stringable $message, array $context = []): void
{
@ -88,11 +63,6 @@ trait LoggerTrait
/**
* Normal but significant events.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function notice(string|\Stringable $message, array $context = []): void
{
@ -103,11 +73,6 @@ trait LoggerTrait
* Interesting events.
*
* Example: User logs in, SQL logs.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function info(string|\Stringable $message, array $context = []): void
{
@ -116,11 +81,6 @@ trait LoggerTrait
/**
* Detailed debug information.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function debug(string|\Stringable $message, array $context = []): void
{
@ -130,11 +90,7 @@ trait LoggerTrait
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string|\Stringable $message
* @param array $context
*
* @return void
* @param mixed $level
*
* @throws \Psr\Log\InvalidArgumentException
*/

View File

@ -15,11 +15,7 @@ class NullLogger extends AbstractLogger
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string|\Stringable $message
* @param array $context
*
* @return void
* @param mixed[] $context
*
* @throws \Psr\Log\InvalidArgumentException
*/

View File

@ -672,7 +672,7 @@ All rights reserved.</copyright>
<location>psr/log</location>
<name>log</name>
<description>Common interface for logging libraries</description>
<version>3.0.0</version>
<version>3.0.2</version>
<license>MIT</license>
<repository>https://github.com/php-fig/log</repository>
</library>