package and depencies
This commit is contained in:
25
vendor/symfony/console/Logger/ConsoleLogger.php
vendored
25
vendor/symfony/console/Logger/ConsoleLogger.php
vendored
@@ -29,8 +29,8 @@ class ConsoleLogger extends AbstractLogger
|
||||
public const INFO = 'info';
|
||||
public const ERROR = 'error';
|
||||
|
||||
private $output;
|
||||
private $verbosityLevelMap = [
|
||||
private OutputInterface $output;
|
||||
private array $verbosityLevelMap = [
|
||||
LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
|
||||
LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
|
||||
LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
|
||||
@@ -40,7 +40,7 @@ class ConsoleLogger extends AbstractLogger
|
||||
LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
|
||||
LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
|
||||
];
|
||||
private $formatLevelMap = [
|
||||
private array $formatLevelMap = [
|
||||
LogLevel::EMERGENCY => self::ERROR,
|
||||
LogLevel::ALERT => self::ERROR,
|
||||
LogLevel::CRITICAL => self::ERROR,
|
||||
@@ -50,7 +50,7 @@ class ConsoleLogger extends AbstractLogger
|
||||
LogLevel::INFO => self::INFO,
|
||||
LogLevel::DEBUG => self::INFO,
|
||||
];
|
||||
private $errored = false;
|
||||
private bool $errored = false;
|
||||
|
||||
public function __construct(OutputInterface $output, array $verbosityLevelMap = [], array $formatLevelMap = [])
|
||||
{
|
||||
@@ -59,12 +59,7 @@ class ConsoleLogger extends AbstractLogger
|
||||
$this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function log($level, $message, array $context = [])
|
||||
public function log($level, $message, array $context = []): void
|
||||
{
|
||||
if (!isset($this->verbosityLevelMap[$level])) {
|
||||
throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
|
||||
@@ -89,10 +84,8 @@ class ConsoleLogger extends AbstractLogger
|
||||
|
||||
/**
|
||||
* Returns true when any messages have been logged at error levels.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasErrored()
|
||||
public function hasErrored(): bool
|
||||
{
|
||||
return $this->errored;
|
||||
}
|
||||
@@ -110,12 +103,12 @@ class ConsoleLogger extends AbstractLogger
|
||||
|
||||
$replacements = [];
|
||||
foreach ($context as $key => $val) {
|
||||
if (null === $val || \is_scalar($val) || (\is_object($val) && method_exists($val, '__toString'))) {
|
||||
if (null === $val || \is_scalar($val) || $val instanceof \Stringable) {
|
||||
$replacements["{{$key}}"] = $val;
|
||||
} elseif ($val instanceof \DateTimeInterface) {
|
||||
$replacements["{{$key}}"] = $val->format(\DateTime::RFC3339);
|
||||
$replacements["{{$key}}"] = $val->format(\DateTimeInterface::RFC3339);
|
||||
} elseif (\is_object($val)) {
|
||||
$replacements["{{$key}}"] = '[object '.\get_class($val).']';
|
||||
$replacements["{{$key}}"] = '[object '.$val::class.']';
|
||||
} else {
|
||||
$replacements["{{$key}}"] = '['.\gettype($val).']';
|
||||
}
|
||||
|
Reference in New Issue
Block a user