• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/diag/logformatter.php
  • Класс: BitrixMainDiagLogFormatter
  • Вызов: LogFormatter::castToString
protected function castToString($value, $placeholder = null): string
{
	if (!is_string($value))
	{
		if (is_object($value))
		{
			if ($placeholder == 'date' && $value instanceof TypeDate)
			{
				$value = $this->formatDate($value);
			}
			elseif ($placeholder == 'exception' && $value instanceof Throwable)
			{
				$value = $this->formatException($value);
			}
			elseif (method_exists($value, '__toString'))
			{
				$value = (string)$value;
			}
			else
			{
				$value = $this->formatMixed($value);
			}
		}
		else
		{
			if ($placeholder == 'trace' && is_array($value))
			{
				$value = $this->formatTrace($value);
			}
			else
			{
				$value = $this->formatMixed($value);
			}
		}
	}
	return $value;
}