/* * CLogFile.cpp * * Created on: 20.04.2009 * Author: gerstrong */ #include #include #include #include "CLogFile.h" #include #include "FindFile.h" #include "Debug.h" CLogFile::CLogFile() {} CLogFile::~CLogFile() { // Logfile End textOut ("

End of logfile"); fclose (m_Logfile); } void CLogFile::CreateLogfile(const char *LogName) { // Open and empty the log file m_Logfile = OpenGameFile(LogName, "wt"); // Write the head textOut("LogFile"); textOut(""); WriteTopic("Logfile", 3); textOut(BLUE,REVISION); // Mark the Build and Platform #ifdef DEBUG textOut("BUILD: DEBUG
"); #else textOut("BUILD: RELEASE
"); #endif #ifdef TARGET_LNX textOut("PLATFORM: LINUX
"); #elif TARGET_WIN32 textOut("PLATFORM: WINDOWS
"); #else textOut("PLATFORM: UNKNOWN
"); #endif // Show my e-mail adress textOut(""); textOut("Send E-Mail to me

"); fclose(m_Logfile); m_Logfile = OpenGameFile(LogName, "at"); } // Function for writing the topic void CLogFile::WriteTopic(const char *Topic, int Size) { textOut("\n\n\n\n\n
\n\n", Size); textOut(Topic); textOut("\n
\n
"); fflush(m_Logfile); } // The main textOut function // Standard textOut (Black color) // Now with colors void CLogFile::textOut(FONTCOLORS Color, const char *Text) { textOut(Color, false, Text); } // Now the entire definition (with list and color) void CLogFile::textOut(FONTCOLORS Color, bool List, const char *Text) { if(List == true) textOut("
  • "); // write color tag switch(Color) { case BLACK: textOut(""); break; case RED: textOut(""); break; case GREEN: textOut(""); break; case BLUE: textOut(""); break; case PURPLE: textOut(""); break; }; // Write the text textOut(Text); textOut(""); if (List == false) textOut("
    "); else textOut("
  • "); } void CLogFile::textOut(const char *Text) { notes << Text << endl; fprintf(m_Logfile,"%s",Text); fflush(m_Logfile); } void CLogFile::ftextOut(const char *Text, ...) { char buffer[MAX_BUFFER]; va_list pArgList; va_start(pArgList, Text); vsprintf(buffer, Text, pArgList); va_end(pArgList); textOut(buffer); } void CLogFile::fltextOut(FONTCOLORS Color, bool List, const char *Text, ...) { char buffer[MAX_BUFFER]; va_list pArgList; va_start(pArgList, Text); vsprintf(buffer, Text, pArgList); va_end(pArgList); textOut(Color, List, buffer); } void CLogFile::ftextOut(FONTCOLORS Color, const char *Text, ...) { char buffer[MAX_BUFFER]; va_list pArgList; va_start(pArgList, Text); vsprintf(buffer, Text, pArgList); va_end(pArgList); textOut(Color, buffer); } void CLogFile::FunctionResult (const char *Name,bool Result) { if (Result == true) { textOut(""); textOut(" border='0' bgcolor='C0C0C0'>", Name); textOut("
    %sOK-/-
    "); } else { textOut(""); textOut(" border='0' bgcolor='C0C0C0'>", Name); textOut("
    %sERROR-/-
    "); } }