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:
@@ -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,7 +505,7 @@ 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,7 +518,7 @@ 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,7 +531,7 @@ 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,7 +544,7 @@ 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,7 +557,7 @@ 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,7 +570,7 @@ 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,7 +583,7 @@ 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,7 +596,7 @@ 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
|
||||||
|
Reference in New Issue
Block a user