GME
13
|
00001 #include "../stdafx.h" 00002 #include ".\CallLogger.h" 00003 #include <fstream> 00004 00005 CallLogger::CallLogger(void) 00006 : m_logEnabled( false) 00007 , m_logFile( "c:\\svnlog.txt") 00008 { 00009 } 00010 00011 CallLogger::~CallLogger(void) 00012 { 00013 } 00014 00015 void CallLogger::setLog( bool p_val, const std::string& p_logFile) 00016 { 00017 m_logEnabled = p_val; 00018 if( !p_logFile.empty()) 00019 m_logFile = p_logFile; 00020 } 00021 00022 void CallLogger::log( const std::string& p_command, const std::string& p_par) 00023 { 00024 if( !m_logEnabled) return; 00025 00026 std::ofstream fs; 00027 fs.open( m_logFile.c_str(), std::ios_base::ate | std::ios_base::app); // append 00028 if( fs) 00029 { 00030 fs << p_command << " " << p_par << std::endl; 00031 fs.close(); 00032 } 00033 } 00034