<?php
/**
 * Debug trait.
 *
 * @package EDD\Pro\CartRecovery\Traits
 * @copyright Copyright (c) 2026, Sandhills Development, LLC
 * @license https://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since 3.6.5
 */

namespace EDD\Pro\CartRecovery\Traits;

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore

/**
 * Debug trait.
 *
 * @since 3.6.5
 */
trait Debug {

	/**
	 * Logs a debug message.
	 *
	 * @since 3.6.5
	 * @param mixed $message The message to log.
	 * @return void
	 */
	private function log( $message, $force = false ): void {

		if ( is_object( $message ) || is_array( $message ) ) {
			$message = var_export( $message, true );
		}

		if ( $message instanceof \Exception ) {
			$message = $message->getMessage();
		}

		edd_debug_log( '[ACR] ' . $message, $force );
	}
}
