• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/diag/logger.php
  • Класс: Bitrix\Main\Diag\Logger
  • Вызов: Logger::log
public function log($level, string|\Stringable $message, array $context = []): void
{
	// Calling this method with a level not defined by this specification MUST throw a Psr\Log\InvalidArgumentException if the implementation does not know about the level.
	if (!isset(static::$supportedLevels[$level]))
	{
		throw new Log\InvalidArgumentException("Log level {$level} is unsupported.");
	}

	if ($this->level !== null && static::$supportedLevels[$level] > $this->level)
	{
		// shouldn't log anything because of the maximum verbose level
		return;
	}

	$this->context = $context;
	$this->message = $message;

	// The message MAY contain placeholders which implementors MAY replace with values from the context array.
	$message = $this->interpolate();

	if ($message != '')
	{
		// actual logging - MUST be defined by a child class
		$this->logMessage($level, $message);
	}
}