//! Defines the logging of transaction messages sent to the client Transaction Actor.
use crate::logging::messages::transactions::base::TransactionJourney;
use crate::messages::client::message::TransactionMessage;

const TARGET: &str = "surrealcs::kernel::client::transaction";

/// Logs a transaction message that the client Transaction Actor has received.
///
/// # Arguments
/// * `message`: the transaction message that the client Transaction Actor has received
pub fn log_start_client_transaction_actor_message(message: &TransactionMessage) {
	if let TransactionMessage::TransactionOperation(operation) = &message {
		let tx_pointer = TransactionJourney::RecievedByClientTransactionActor;
		let log = tx_pointer.from_wrapped_server_message(operation);
		if let Some(log) = log {
			tracing::trace!(target: TARGET, "{log}");
		}
	}
}
