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