Ejemplo n.º 1
0
 /**
  * @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided
  * @param int       $maxLevel       Maximum level to accept, only used if $minLevelOrList is not an array
  */
 public function setAcceptedLevels($minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY)
 {
     if (is_array($minLevelOrList)) {
         $acceptedLevels = array_map('Monolog\\Logger::toMonologLevel', $minLevelOrList);
     } else {
         $minLevelOrList = Logger::toMonologLevel($minLevelOrList);
         $maxLevel = Logger::toMonologLevel($maxLevel);
         $acceptedLevels = array_values(array_filter(Logger::getLevels(), function ($level) use($minLevelOrList, $maxLevel) {
             return $level >= $minLevelOrList && $level <= $maxLevel;
         }));
     }
     $this->acceptedLevels = array_flip($acceptedLevels);
 }