Automattic\WooCommerce\Internal\PushNotifications\Services

NotificationStepLogger::log_failure │ public │ WC 11.3.0

Records a failure as an error or warning under the module's own source, which is never switched off, and as a step in the notification's journey. The error line carries the same identifying fields as the step, so a store whose log threshold drops info still has a line the read path can join to the notification.

Where identifying the notification fails, the error line is still written, without those fields.

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

Хуков нет.

Возвращает

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

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

$NotificationStepLogger = new NotificationStepLogger();
$NotificationStepLogger->log_failure( $notification, $step, $outcome, $level, $message, $context ): void;
$notification(Notification) (обязательный)
The notification the failure belongs to.
$step(строка) (обязательный)
Machine-readable step name, e.g. dispatched.
$outcome(строка) (обязательный)
Machine-readable outcome, e.g. request_failed.
$level(строка) (обязательный)
error or warning.
$message(строка) (обязательный)
Human-readable message for the error log.
$context(массив)
Extra scalar fields to store with both lines.
По умолчанию: array()

Список изменений

С версии 11.3.0 Введена.

Код NotificationStepLogger::log_failure() WC 11.3.0

public function log_failure( Notification $notification, string $step, string $outcome, string $level, string $message, array $context = array() ): void {
	try {
		$identified = self::identify( $notification, $step, $outcome, $context );
	} catch ( Throwable $e ) {
		$this->log_unattributed_failure( $step, $outcome, $level, $message, $context );
		return;
	}

	$this->write_error( $level, $message, $identified );
	$this->log_notification_step( $notification, $step, $outcome, $context );
}