Logger::to_php_error_constant( string $level )

Converts a PSR-3 log level to a PHP error constant to use for it.

Description

See also

Parameters

$level

(string) (Required) PSR-3 log level.

Return

(int) PHP error constant.

Source

File: src/logger.php

	protected function to_php_error_constant( $level ) {
		if ( ! isset( $this->level_mappings[ $level ] ) ) {
			throw new InvalidArgumentException( sprintf( 'Level %1$s is not defined, use one of: %2$s', $level, implode( ', ', array_keys( $this->level_mappings ) ) ) );
		}

		return $this->level_mappings[ $level ];
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.