Index: /ether_eccad/trunk/ECCAD_INSERT/src/Logger.cpp
===================================================================
--- /ether_eccad/trunk/ECCAD_INSERT/src/Logger.cpp	(revision 81)
+++ /ether_eccad/trunk/ECCAD_INSERT/src/Logger.cpp	(revision 81)
@@ -0,0 +1,166 @@
+#include "Logger.h"
+
+#include <syslog.h>
+
+#include <iostream>
+using namespace std;
+
+
+Logger::Logger()
+{
+	nbreFilesErrors = 0;
+	nbreFilesUpdate = 0;
+	nbreFilesInsert = 0;
+}
+
+Logger::~Logger()
+{
+	
+}
+
+void Logger::printAllMessages(time_t debut){
+	
+		cout<<endl<<endl<< "============Rapport d'insertion=============="<<endl<<endl;
+		
+		
+		
+		list<string>::iterator strIter;
+   		for(strIter=Xml_GeneralMessages.begin(); strIter != Xml_GeneralMessages.end(); ++strIter){
+			cout << *strIter << endl;
+		}
+		
+		if(XmlParse_Error.size() > 0) cerr << "XML Parsing Failed :\n";
+   		for(strIter=XmlParse_Error.begin(); strIter != XmlParse_Error.end(); ++strIter){
+			cerr << *strIter << endl;
+		}
+		
+		/*if(XmlSchemaValidation_Error.size() > 0) cerr << "XML Schema Validation Failed :\n";
+   		for(strIter=XmlSchemaValidation_Error.begin(); strIter != XmlSchemaValidation_Error.end(); ++strIter){
+			cerr << *strIter << endl;
+		}*/
+		
+		if(XmlConsistencyValidation_Error.size() > 0) cerr << "XML File Consistency Verification Failed :\n";
+   		for(strIter=XmlConsistencyValidation_Error.begin(); strIter != XmlConsistencyValidation_Error.end(); ++strIter){
+			cerr << *strIter << endl;
+		}
+		
+		//MappingBaseMessages
+   		/*for(strIter=baseMappingMessagesErrors.begin(); strIter != baseMappingMessagesErrors.end(); ++strIter){
+			cerr << *strIter << endl;
+		}
+		
+		if ( baseMappingMessagesErrors.empty() &&  XmlConsistencyValidation_Error.empty() && XmlSchemaValidation_Error.empty()
+		&& XmlParse_Error.empty()) cout << "Synchronisation XML --> Base OK."<<endl;
+		//MappingBaseMessages
+   		
+   		for(strIter=baseMappingMessages.begin(); strIter != baseMappingMessages.end(); ++strIter){
+			cout << *strIter << endl;
+		}
+   		
+   		for(strIter=baseMappingMessagesErrors.begin(); strIter != baseMappingMessagesErrors.end(); ++strIter){
+			
+			cerr << "erreur base"<<endl;
+			cerr << *strIter << endl;
+		}*/
+		
+		
+		for(strIter=readersMessagesErrors.begin(); strIter != readersMessagesErrors.end(); ++strIter){
+			cout << *strIter << endl;
+		}
+		
+		cout << nbreFilesInsert <<" fichier(s) insere(s)" <<endl;
+		cout << nbreFilesUpdate <<" fichier(s) mis a jour" <<endl;
+		cout << nbreFilesErrors <<" fichier(s) errone(s)" <<endl;
+		//ParcoursArborescenceMessages 
+		if (debut != -1) {
+			const time_t fin = time(NULL);
+			cout<<"-----> Temps Ã©coulÃ©: "<< difftime(fin,debut)<<" secondes" <<endl;
+//			long clockpersec = CLOCKS_PER_SEC;
+//			double difference = (double)(fin - debut)/(double)clockpersec;
+//			printf("----> Temps Ã©coulÃ©: %.2f secondes\n",difference);
+		}
+		cout<< "============***************=============="<<endl;
+}
+
+void Logger::logAllMessages(){
+	
+	list<string>::iterator strIter;	
+	
+	openlog("ECCAD INSERT", LOG_CONS|LOG_PID, LOG_LOCAL7);
+	
+	for(strIter=baseMappingMessagesErrors.begin(); strIter != baseMappingMessagesErrors.end(); ++strIter){
+			syslog(LOG_ERR,(*strIter).c_str());
+		}
+	closelog();
+	
+}
+	
+void Logger::addGeneralXmlMessage(string message){
+	Xml_GeneralMessages.push_back(message);
+}
+
+void Logger::addXmlParseError(string message){
+	XmlParse_Error.push_back(message);
+}
+
+void Logger::addXmlSchemaValidationError(string message){
+	XmlSchemaValidation_Error.push_back(message);
+}
+
+void Logger::addXmlConsistencyValidationError(string message){
+	XmlConsistencyValidation_Error.push_back(message);
+}
+
+void Logger::addXmlObjectMappingMessage(string message){
+	Xml_ObjectMappingMessages.push_back(message);
+}
+	
+void Logger::addXmlObjectMappingError(string message){
+	XmlObjectMapping_Error.push_back(message);
+}
+
+
+/// Traitement des message du mapping vers la base de donnï¿œes//////////////
+void Logger::addBaseMappingMessages(string message)
+{
+	 baseMappingMessages.push_back(message);
+}
+
+void Logger::addBaseMappingMessagesErrors(string message)
+{
+	 baseMappingMessagesErrors.push_back(message);
+}
+
+void Logger::traitementBaseMessages(string message, PGresult* res)
+{
+	if ( PQresultStatus(res) != PGRES_COMMAND_OK) 
+			{
+				string erreur = "Erreur " +message+ " : " ;
+				erreur += PQresultErrorMessage(res);
+				erreur += " : ";
+				erreur += PQresStatus(PQresultStatus(res));
+				addBaseMappingMessagesErrors(erreur);
+			}
+			else
+			{
+				string succes = PQcmdTuples(res)+ message;
+				succes += " : ";
+				succes += PQresStatus(PQresultStatus(res));
+				addBaseMappingMessages(succes);
+			}
+}
+
+
+void Logger::addReadersMessagesErrors(string message)
+{
+	readersMessagesErrors.push_back(message);
+}
+
+bool Logger::errorsExist()
+{
+	if (XmlParse_Error.empty() && XmlSchemaValidation_Error.empty()  && XmlConsistencyValidation_Error.empty() && XmlObjectMapping_Error.empty() && baseMappingMessagesErrors.empty() && readersMessagesErrors.empty())
+	return true;
+	else return false;
+}
+
+
