Automattic\WooCommerce\Internal\PushNotifications\Services

NotificationStepLogger::write_error │ private │ WC 1.0

Writes one line to the module's own error source, swallowing any failure.

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

Хуков нет.

Возвращает

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

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

// private - только в коде основоного (родительского) класса
$result = $this->write_error( $level, $message, $context ): void;
$level(строка) (обязательный)
error or warning.
$message(строка) (обязательный)
Human-readable message.
$context(массив) (обязательный)
Fields to store with the line.

Код NotificationStepLogger::write_error() WC 11.3.0

private function write_error( string $level, string $message, array $context ): void {
	try {
		$context['source']         = PushNotifications::FEATURE_NAME;
		$context['remote-logging'] = false;

		wc_get_logger()->log( $level, self::clean( $message, self::MAX_MESSAGE_LENGTH ), self::bound( $context ) );
	} catch ( Throwable $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
		// Deliberately ignored: a logging failure must not affect the send.
	}
}