Automattic\WooCommerce\Internal\PushNotifications\Services

NotificationStepLogger::is_active │ public │ WC 11.3.0

Whether step logging is active, decided once per logger.

The container resolves one logger per request, so in practice the filter runs once a request.

A filter callback that throws turns logging off, since callers outside this class read the answer without guarding against it.

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

Возвращает

bool.

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

$NotificationStepLogger = new NotificationStepLogger();
$NotificationStepLogger->is_active(): bool;

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

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

Код NotificationStepLogger::is_active() WC 11.3.0

public function is_active(): bool {
	if ( null !== $this->active ) {
		return $this->active;
	}

	try {
		/**
		 * Filters whether push notification step logging is enabled.
		 *
		 * Evaluated once per logger, and the container resolves one per
		 * request. Turning it off stops the journey lines only; the module's
		 * error and warning logging is unaffected.
		 *
		 * @since 11.3.0
		 *
		 * @param bool $enabled Whether step logging is enabled. Default true.
		 */
		$enabled = (bool) apply_filters( 'woocommerce_push_notification_step_logging_enabled', true );
	} catch ( Throwable $e ) {
		$enabled = false;
	}

	$this->active = $enabled;

	return $this->active;
}