1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 20:57:36 +02:00

Adjust phpdoc to match the psr/log 3 interface, refs #1589

This commit is contained in:
Jordi Boggiano
2021-09-15 13:27:21 +02:00
parent 18eb14b78a
commit 437e7a1c50

View File

@@ -17,6 +17,7 @@ use Psr\Log\LoggerInterface;
use Psr\Log\InvalidArgumentException; use Psr\Log\InvalidArgumentException;
use Psr\Log\LogLevel; use Psr\Log\LogLevel;
use Throwable; use Throwable;
use Stringable;
/** /**
* Monolog log channel * Monolog log channel
@@ -482,14 +483,18 @@ class Logger implements LoggerInterface, ResettableInterface
* *
* This method allows for compatibility with common interfaces. * This method allows for compatibility with common interfaces.
* *
* @param int|string $level The log level * @param mixed $level The log level
* @param string $message The log message * @param string|Stringable $message The log message
* @param mixed[] $context The log context * @param mixed[] $context The log context
* *
* @phpstan-param Level|LevelName|LogLevel::* $level * @phpstan-param Level|LevelName|LogLevel::* $level
*/ */
public function log($level, $message, array $context = []): void public function log($level, $message, array $context = []): void
{ {
if (!is_int($level) && !is_string($level)) {
throw new \InvalidArgumentException('$level is expected to be a string or int');
}
$level = static::toMonologLevel($level); $level = static::toMonologLevel($level);
$this->addRecord($level, (string) $message, $context); $this->addRecord($level, (string) $message, $context);
@@ -500,8 +505,8 @@ class Logger implements LoggerInterface, ResettableInterface
* *
* This method allows for compatibility with common interfaces. * This method allows for compatibility with common interfaces.
* *
* @param string $message The log message * @param string|Stringable $message The log message
* @param mixed[] $context The log context * @param mixed[] $context The log context
*/ */
public function debug($message, array $context = []): void public function debug($message, array $context = []): void
{ {
@@ -513,8 +518,8 @@ class Logger implements LoggerInterface, ResettableInterface
* *
* This method allows for compatibility with common interfaces. * This method allows for compatibility with common interfaces.
* *
* @param string $message The log message * @param string|Stringable $message The log message
* @param mixed[] $context The log context * @param mixed[] $context The log context
*/ */
public function info($message, array $context = []): void public function info($message, array $context = []): void
{ {
@@ -526,8 +531,8 @@ class Logger implements LoggerInterface, ResettableInterface
* *
* This method allows for compatibility with common interfaces. * This method allows for compatibility with common interfaces.
* *
* @param string $message The log message * @param string|Stringable $message The log message
* @param mixed[] $context The log context * @param mixed[] $context The log context
*/ */
public function notice($message, array $context = []): void public function notice($message, array $context = []): void
{ {
@@ -539,8 +544,8 @@ class Logger implements LoggerInterface, ResettableInterface
* *
* This method allows for compatibility with common interfaces. * This method allows for compatibility with common interfaces.
* *
* @param string $message The log message * @param string|Stringable $message The log message
* @param mixed[] $context The log context * @param mixed[] $context The log context
*/ */
public function warning($message, array $context = []): void public function warning($message, array $context = []): void
{ {
@@ -552,8 +557,8 @@ class Logger implements LoggerInterface, ResettableInterface
* *
* This method allows for compatibility with common interfaces. * This method allows for compatibility with common interfaces.
* *
* @param string $message The log message * @param string|Stringable $message The log message
* @param mixed[] $context The log context * @param mixed[] $context The log context
*/ */
public function error($message, array $context = []): void public function error($message, array $context = []): void
{ {
@@ -565,8 +570,8 @@ class Logger implements LoggerInterface, ResettableInterface
* *
* This method allows for compatibility with common interfaces. * This method allows for compatibility with common interfaces.
* *
* @param string $message The log message * @param string|Stringable $message The log message
* @param mixed[] $context The log context * @param mixed[] $context The log context
*/ */
public function critical($message, array $context = []): void public function critical($message, array $context = []): void
{ {
@@ -578,8 +583,8 @@ class Logger implements LoggerInterface, ResettableInterface
* *
* This method allows for compatibility with common interfaces. * This method allows for compatibility with common interfaces.
* *
* @param string $message The log message * @param string|Stringable $message The log message
* @param mixed[] $context The log context * @param mixed[] $context The log context
*/ */
public function alert($message, array $context = []): void public function alert($message, array $context = []): void
{ {
@@ -591,8 +596,8 @@ class Logger implements LoggerInterface, ResettableInterface
* *
* This method allows for compatibility with common interfaces. * This method allows for compatibility with common interfaces.
* *
* @param string $message The log message * @param string|Stringable $message The log message
* @param mixed[] $context The log context * @param mixed[] $context The log context
*/ */
public function emergency($message, array $context = []): void public function emergency($message, array $context = []): void
{ {