1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-24 01:56:18 +02:00

Restore getLevelName but deprecate it

This commit is contained in:
Jordi Boggiano
2022-04-24 13:49:06 +02:00
parent bd5968a567
commit c312cfdabf
2 changed files with 17 additions and 1 deletions

View File

@@ -365,6 +365,23 @@ class Logger implements LoggerInterface, ResettableInterface
}
}
/**
* Gets the name of the logging level as a string.
*
* This still returns a string instead of a LevelName for BC, but new code should not rely on this method.
*
* @throws \Psr\Log\InvalidArgumentException If level is not defined
*
* @phpstan-param Level $level
* @phpstan-return LevelName
*
* @deprecated Use Monolog\Level->toLevelName()->value instead
*/
public static function getLevelName(int|Level $level): string
{
return self::toMonologLevel($level)->toLevelName()->value;
}
/**
* Converts PSR-3 levels to Monolog ones if necessary
*