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].");
        }
    }
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].");
        }
    }
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]." ) ; } }
Check if level exists in list of possible levels
Psr\Log suggests to throw Psr\Log\InvalidArgumentException if  incompatible log level passed
@param mixed $level
@throws InvalidArgumentException
Check if level exists in list of possible levels Psr \ Log suggests to throw Psr \ Log \ InvalidArgumentException if incompatible log level passed