<?php
/**
 * Gateway request and response logger trait.
 *
 * @package flo-checkout
 *
 * @phpcs:disable Squiz.Commenting.FunctionComment.MissingParamTag
 */

namespace Flo_Checkout\Gateways\Shift4_APM\Traits;

use Northmill_Online_Shared_Checkout\Northmill_Online_Shared\Modules\Loggers\Log_Level_Enum;

defined( 'ABSPATH' ) || exit;

/**
 * Gateway request and response logger trait.
 */
trait Gateway_Request_And_Response_Logger_Trait {

	/**
	 * {@inheritDoc}
	 */
	protected function log( string $message, ?array $context = null, Log_Level_Enum $level = Log_Level_Enum::DEBUG ): void {
		$this->gateway->log( $message, $context, $level );
	}

	/**
	 * {@inheritDoc}
	 */
	protected function log_and_throw_error(
		string $front_end_message,
		?array $context = null,
		?string $back_end_message = null,
		Log_Level_Enum $log_level = Log_Level_Enum::ERROR
	): never {
		$this->gateway->log_and_throw_error(
			$front_end_message,
			$context,
			$back_end_message,
			$log_level
		);
	}
}
