Automattic\WooCommerce\Internal\Admin\Schedulers

ImportScheduler::log_import_error │ protected static │ WC 1.0

Log details for an item that failed analytics import.

Метод класса: ImportScheduler{}

Хуков нет.

Возвращает

void. Ничего (null).

Использование

$result = ImportScheduler::log_import_error( $item_id, $error, $context );
$item_id(int) (обязательный)
Import item ID.
$error(Throwable) (обязательный)
Error thrown during import.
$context(массив)
Additional logger context.
По умолчанию: array()

Код ImportScheduler::log_import_error() WC 11.2.1

final protected static function log_import_error( $item_id, \Throwable $error, array $context = array() ) {
	$logger      = wc_get_logger();
	$log_context = array_merge(
		array(
			'source' => 'wc-analytics-import',
		),
		$context,
		array(
			'scheduler'       => static::$name,
			'item_id'         => (int) $item_id,
			'exception_class' => get_class( $error ),
			'exception_file'  => $error->getFile(),
			'exception_line'  => $error->getLine(),
			'trace'           => $error->getTraceAsString(),
		)
	);

	$logger->error(
		sprintf(
			'Failed to import analytics item %1$d for %2$s: [%3$s] %4$s in %5$s:%6$d',
			$item_id,
			static::$name,
			get_class( $error ),
			$error->getMessage(),
			$error->getFile(),
			$error->getLine()
		),
		$log_context
	);
}