• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/internals/diag.php
  • Класс: BitrixDiskInternalsDiag
  • Вызов: Diag::logDebugInfo
public function logDebugInfo($uniqueId, $label = null)
{
	if($label === null)
	{
		$label = $uniqueId;
	}

	if($this->exclusiveUserId !== null && $this->getUser()->getId() != $this->exclusiveUserId)
	{
		return;
	}

	$debugData = array();
	if($this->enableTimeTracker)
	{
		Debug::endTimeLabel($uniqueId);
		$timeLabels = Debug::getTimeLabels();
		$debugData[] = "Time: {$timeLabels[$uniqueId]['time']}";
		$this->summaryTime += $timeLabels[$uniqueId]['time'];
	}
	if($this->sqlBehavior & (self::SQL_COUNT | self::SQL_DETECT_LIKE | self::SQL_PRINT_ALL))
	{
		list($prevLabel, $prevLabelCount, $prevSqlTrackerQueries) = array_pop($this->stackSql);

		list($countQueries, $sqlTrackerQueries) = $this->getDebugInfoSql();
		if($countQueries === null)
		{
			$sqlTrackerQueries = array();
			$debugData[] = 'COULD NOT GET SQL TRACKER!';
		}
		else
		{
			if($prevLabel === $uniqueId)
			{
				$countQueries += $prevLabelCount;
				$sqlTrackerQueries = array_merge($prevSqlTrackerQueries, $sqlTrackerQueries);
			}

			if($this->sqlBehavior & self::SQL_COUNT)
			{
				$this->summarySqlCount += $countQueries;
				$debugData[] = 'Count sql: ' . $countQueries;
			}
		}
	}
	if($this->sqlBehavior & (self::SQL_COUNT | self::SQL_DETECT_LIKE | self::SQL_PRINT_ALL))
	{
		/** @var SqlTrackerQuery[] $sqlTrackerQueries */
		foreach($sqlTrackerQueries as $query)
		{
			if($this->sqlBehavior & self::SQL_PRINT_ALL)
			{
				$debugData[] = array(
					$query->getTime(),
					$query->getSql(),
					$this->reformatBackTrace($query->getTrace())
				);
			}

			if(($this->sqlBehavior & self::SQL_DETECT_LIKE) && mb_stripos($query->getSql(), 'upper') !== false)
			{
				$this->log(array(
					'Oh... LIKE UPPER... Delete! Destroy!',
					$this->reformatBackTrace($query->getTrace()),
				));
				throw new SystemException('Oh... LIKE UPPER... Delete! Destroy!');
			}
		}
		unset($query);
	}
	if($this->enableErrorHandler)
	{
		error_reporting($this->prevErrorReporting);
		restore_error_handler();
	}
	if($this->memoryBehavior & self::MEMORY_PRINT_DIFF)
	{
		list($prevLabel, $prevMemoryStart) = array_pop($this->stackMemory);
		if($prevLabel === $uniqueId)
		{
			$debugData[] = 'Memory start: ' . $this->formatSize($prevMemoryStart);
			$debugData[] = 'Memory diff: ' . $this->formatSize(memory_get_usage(true) - $prevMemoryStart);
		}
		//$debugData[] = 'Memory: ' . round(memory_get_usage(true) / 1024, 2) . ' Kb';
	}
	if($this->memoryBehavior & self::MEMORY_PRINT_AMOUNT)
	{
		$debugData[] = 'Memory amount: ' . $this->formatSize(memory_get_usage(true));
	}
	if($this->memoryBehavior & self::MEMORY_PRINT_PEAK_USAGE)
	{
		$debugData[] = 'Memory peak usage: ' . $this->formatSize(memory_get_peak_usage(true));
	}
	if($debugData)
	{
		array_unshift($debugData, "Label: {$label}");
		$this->log($debugData);
	}
}