Retrieve the logs for the matching level.

@param  string  $level
@return array
196991
public function getLogs($level = null)
	{
		// If no level was given, return all logs.
		if(is_null($level))
		{
			return $this->logs;
		}

		else
		{
			if(isset($this->logs[$level]))
			{
				return $this->logs[$level];
			}
		}

		// If the level doesn't exist, just return an empty array.
		//
		// @todo: check that the level exists, otherwise throw an exception. 
		return array();
	}
1152174
public function getCurrentToAttr($level)
    {
        $lookupNames = StringHelper::split(BaseLookup::$lookupPattern, $this->prefetchTo);
        $toAttr = $lookupNames[$level];
        $hasAsAttr = $this->toAttr && $level === count($lookupNames) - 1;
        return [$toAttr, $hasAsAttr];
    }
587978
public static function getLevelName($level)
    {
        if (!isset(static::$levels[$level])) {
            throw new \InvalidArgumentException('Level "' . $level . '" is not defined, use one of: ' . implode(', ', array_keys(static::$levels)));
        }

        return static::$levels[$level];
    }
1205915
public function getMediaFolderByLevels($levels)
    {
        $qb = $this->createQueryBuilder('mf')
                   ->andWhere('mf._level IN (:levels)')
                   ->setParameter('levels', $levels)
                   ->orderBy('mf._leftnode', 'asc');

        return $qb->getQuery()->getResult();
    }
488021
public function descendants($level = null)
	{
		$instance = self::blank();
		$instance->where('level', '>', $this->level)
		         ->order('lft', 'asc');

		if (isset($level))
		{
			$instance->where('level', '<=', $this->level + $level);
		}

		return $instance->where('lft', '>', $this->lft)
		                ->where('rgt', '<', $this->rgt)
		                ->applyScopesWhere($this);
	}
585417
public function getLogs($key = '')
    {
        if ($key) {
            if (isset($this->logs[$key])) {
                if (!is_array($this->logs[$key])) {
                    return [$this->logs[$key]];
                } else {
                    return $this->logs[$key];
                }
            } else {
                return null;
            }
        }

        return $this->logs;
    }
321976
public static function getLevelString( $level )
    {
        $name = '';

        switch ( $level )
        {
            case self::LEVEL_DEBUG:
                $name = 'DEBUG';
                break;

            case self::LEVEL_INFO:
                $name = 'INFO';
                break;

            case self::LEVEL_NOTICE:
                $name = 'NOTICE';
                break;

            case self::LEVEL_WARNING:
                $name = 'WARNING';
                break;

            case self::LEVEL_ERROR:
                $name = 'ERROR';
                break;

            case self::LEVEL_CRITICAL:
                $name = 'CRITICAL';
                break;

            case self::LEVEL_ALERT:
                $name = 'ALERT';
                break;

            case self::LEVEL_EMERGENCY:
                $name = 'EMERGENCY';
                break;

            default:
                $name = '';
                break;
        }

        return $name;
    }
361451
protected function normalizeLevel($level)
    {
        if (isset($this->logLevelMap[$level])) {
            return $this->logLevelMap[$level];
        }
        return strtolower($level);
    }
620259
public static function logLevel($level)
  {
    if(is_numeric($level))
    {
      if($level == TeamSpeak3::LOGLEVEL_CRITICAL)
        return "CRITICAL";
      if($level == TeamSpeak3::LOGLEVEL_ERROR)
        return "ERROR";
      if($level == TeamSpeak3::LOGLEVEL_DEBUG)
        return "DEBUG";
      if($level == TeamSpeak3::LOGLEVEL_WARNING)
        return "WARNING";
      if($level == TeamSpeak3::LOGLEVEL_INFO)
        return "INFO";

      return "DEVELOP";
    }
    else
    {
      if(strtoupper($level) == "CRITICAL")
        return TeamSpeak3::LOGLEVEL_CRITICAL;
      if(strtoupper($level) == "ERROR")
        return TeamSpeak3::LOGLEVEL_ERROR;
      if(strtoupper($level) == "DEBUG")
        return TeamSpeak3::LOGLEVEL_DEBUG;
      if(strtoupper($level) == "WARNING")
        return TeamSpeak3::LOGLEVEL_WARNING;
      if(strtoupper($level) == "INFO")
        return TeamSpeak3::LOGLEVEL_INFO;

      return TeamSpeak3::LOGLEVEL_DEVEL;
    }
  }
363143
public function checkLevel($level)
    {
        if (static::$levels === null) {
            // Psr\Log does not provide Enum, so we need to load levels from LogLevel constants
            $reflection = new \ReflectionClass(LogLevel::class);
            static::$levels = $reflection->getConstants();
        }

        if (!in_array($level, static::$levels)) {
            $levels = implode(', ', static::$levels);
            throw new InvalidArgumentException("Level must be one of [$levels].");
        }
    }
305798
public static function getLevelByName($level)
    {
        $level = strtoupper($level);
        if (!isset(static::$levelNameToLevel[$level])) {
            return static::ALL;
        }

        return static::$levelNameToLevel[$level];
    }
999053
public static function getLevelName($level)
    {
        static $levels = [
            Logger::LEVEL_ERROR => 'error',
            Logger::LEVEL_WARNING => 'warning',
            Logger::LEVEL_INFO => 'info',
            Logger::LEVEL_TRACE => 'debug',
            Logger::LEVEL_PROFILE_BEGIN => 'debug',
            Logger::LEVEL_PROFILE_END => 'debug',
        ];

        return isset($levels[$level]) ? $levels[$level] : 'error';
    }
479590
private function needToLog(string $level): bool
    {
        $logLevels = [LogLevel::EMERGENCY => 0,
                      LogLevel::ALERT     => 1,
                      LogLevel::CRITICAL  => 2,
                      LogLevel::ERROR     => 3,
                      LogLevel::WARNING   => 4,
                      LogLevel::NOTICE    => 5,
                      LogLevel::INFO      => 6,
                      LogLevel::DEBUG     => 7];

        if (isset($logLevels[$this->getApp()->getConfig()->getLogLevel()])) {
            return isset($logLevels[$level]) && $logLevels[$level] <= $logLevels[$this->getApp()->getConfig()->getLogLevel()];
        } else {
            return false;
        }
    }
495204
private function readLogs(): array
	{
		$logs = [];
		$dir = @dir($this->path);
		if (!$dir) {
			throw new IOException("getLogs: Failed opening directory '$this->path' for reading");
		}
		while ($file = $dir->read()) {
			if ($file == '.' || $file == '..' || $file == 'web.config' || $file == '.htaccess') {
				continue;
			} else {
				$hash = $this->hasher->hash($file);
				$logs[$hash] = new Log($hash, $this->path, $file);
			}
		}
		return $logs;
	}
237040
protected function normalizeLevel($level)
    {
        if (is_int($level) && array_search($level, self::$levels) !== false) {
            return $level;
        }

        if (is_string($level) && isset(self::$levels[$level])) {
            return self::$levels[$level];
        }

        throw new Exception(
            sprintf("Unknown LogLevel: '%s'", $level)
        );
    }
563354
public static function logLevel($level)
    {
        if (is_numeric($level)) {
            if ($level == Teamspeak::LOGLEVEL_CRITICAL) {
                return "CRITICAL";
            }
            if ($level == Teamspeak::LOGLEVEL_ERROR) {
                return "ERROR";
            }
            if ($level == Teamspeak::LOGLEVEL_DEBUG) {
                return "DEBUG";
            }
            if ($level == Teamspeak::LOGLEVEL_WARNING) {
                return "WARNING";
            }
            if ($level == Teamspeak::LOGLEVEL_INFO) {
                return "INFO";
            }

            return "DEVELOP";
        } else {
            if (strtoupper($level) == "CRITICAL") {
                return Teamspeak::LOGLEVEL_CRITICAL;
            }
            if (strtoupper($level) == "ERROR") {
                return Teamspeak::LOGLEVEL_ERROR;
            }
            if (strtoupper($level) == "DEBUG") {
                return Teamspeak::LOGLEVEL_DEBUG;
            }
            if (strtoupper($level) == "WARNING") {
                return Teamspeak::LOGLEVEL_WARNING;
            }
            if (strtoupper($level) == "INFO") {
                return Teamspeak::LOGLEVEL_INFO;
            }

            return Teamspeak::LOGLEVEL_DEVEL;
        }
    }
1026314
public static function getVerbosityForLevel($level) {
        if ($level === 0) {
            return self::NORMAL;
        }

        if ($level === 1) {
            return self::VERBOSE;
        }

        if ($level === 3) {
            return self::SILENT;
        }

        return self::DEBUG;
    }