Skip to content

Commit

Permalink
Method for log levels
Browse files Browse the repository at this point in the history
  • Loading branch information
niksamokhvalov committed Nov 26, 2015
1 parent 2d4e831 commit 832909d
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/Handler/BitrixHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,24 @@ public function setSite($siteId)
*/
public static function toBitrixLevel($level)
{
$levels = array(
$levels = static::logLevels();

if (isset($levels[$level]))
{
return $levels[$level];
}

return false;
}

/**
* Translates Monolog log levels to Bitrix levels.
*
* @return array
*/
public static function logLevels()
{
return array(
Logger::DEBUG => 'DEBUG',
Logger::INFO => 'INFO',
Logger::NOTICE => 'WARNING',
Expand All @@ -82,12 +99,5 @@ public static function toBitrixLevel($level)
Logger::ALERT => 'ERROR',
Logger::EMERGENCY => 'ERROR',
);

if (isset($levels[$level]))
{
return $levels[$level];
}

return false;
}
}

0 comments on commit 832909d

Please sign in to comment.