<?php

require_once 'log.php';

define('GRAYDON_LOGFILE',PATH_LOGS.'graydon-requetes.log');

/**
 * Enregistre chaque appel de méthode graydon dans un fichier
 *
 * @param string $login
 *  Login de l'utilisateur
 * @param string $page
 * 	Nom de la page
 * @param string $requete
 * 	Requête Graydon effectué
 * @param string $transactionIdentifier
 * 	Identifiant de transaction Graydon
 * @param string $sessionIdentifier
 * 	Identifiant de session Graydon
 * @return void
 */
function graydonRequeteLog($login, $page, $requete, $transactionIdentifier, $sessionIdentifier){
	$tabData = array( 	"Date" => date('Y/m/d H:i:s'),
						"Login" => $login,
						"Page" => $page,
						"Requete" => $requete,
						"TransactionIdentifier" => $transactionIdentifier,
						"SessionIdentifier" => $sessionIdentifier,
					);
	writeLog(GRAYDON_LOGFILE, $tabData, ';');
}

function graydonDbLog($login, $action, $requete, $transactionIdentifier, $sessionIdentifier){
	$log = new Requetelog();
	$log->login = $_SESSION['tabInfo']['login'];
	$log->action = 'placeOrder';
	$log->request = serialize($request);
	$log->transactionIdentifier = $transactionIdentifier;
	$log->sessionID = $sessionID;
	$log->mode = $mode;
	$log->save();
}


?>