예제 #1
0
 /**
  * testGetLogLevelsWithMinimumLevel
  *
  * Tests if Logger::getLogLevels with a minimum LogLevel constant as argument returns the expected array with LogLevel constants
  *
  * @access public
  * @return void
  **/
 public function testGetLogLevelsWithMinimumLevel()
 {
     $expectedArray = array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR, LogLevel::WARNING);
     $this->assertEquals($expectedArray, Logger::getLogLevels(LogLevel::WARNING));
 }
예제 #2
0
 /**
  * isLoggingForChannelAndLogLevel
  *
  * Returns true when:
  * - $level is equal to or above the minimum configured log level
  *
  * And
  *
  * - No channel has been set in $context
  * - No channels have been set in the adapter (meaning log all channels)
  * - The channel in $context is set as channel in this adapter
  *
  * @access public
  * @param  string   $level
  * @param  array    $context
  * @return boolean
  **/
 protected function isLoggingForChannelAndLogLevel($level, array $context)
 {
     $isLogging = true;
     if (!in_array($level, Logger::getLogLevels($this->getConfigurationValue("level")))) {
         $isLogging = false;
     }
     if ($isLogging === true && (!array_key_exists("channel", $context) || count($this->getChannels()) === 0 || in_array($context["channel"], $this->getChannels()))) {
         $isLogging = true;
     }
     return $isLogging;
 }