mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 05:07:36 +02:00
Merge pull request #1406 from mpdude/fix-tr-locale
Fix a bug when using string-based loglevels in the `tr_TR` locale
This commit is contained in:
@@ -527,8 +527,13 @@ class Logger implements LoggerInterface, ResettableInterface
|
||||
*/
|
||||
public static function toMonologLevel($level)
|
||||
{
|
||||
if (is_string($level) && defined(__CLASS__.'::'.strtoupper($level))) {
|
||||
return constant(__CLASS__.'::'.strtoupper($level));
|
||||
if (is_string($level)) {
|
||||
// Contains chars of all log levels and avoids using strtoupper() which may have
|
||||
// strange results depending on locale (for example, "i" will become "İ")
|
||||
$upper = strtr($level, 'abcdefgilmnortuwy', 'ABCDEFGILMNORTUWY');
|
||||
if (defined(__CLASS__.'::'.$upper)) {
|
||||
return constant(__CLASS__ . '::' . $upper);
|
||||
}
|
||||
}
|
||||
|
||||
return $level;
|
||||
|
Reference in New Issue
Block a user