1
1
forked from 0ad/0ad
0ad/source/ps/CLogger.h
olsner d736ac7026 CLogger Initial Commit
This was SVN commit r206.
2004-04-14 21:52:59 +00:00

59 lines
1.1 KiB
C++
Executable File

#ifndef _ps_CLogger_H
#define _ps_CLogger_H
#include <fstream>
#include <stdio.h>
#include <stdarg.h>
#include <string>
#include <vector>
#define LOG (CLogger::GetInstance()->Log)
enum ELogMethod
{
NORMAL,
MESSAGE=NORMAL,
ERROR,
WARNING
};
class CLogger
{
public:
//Function used to get instance of CLogger
static CLogger *GetInstance();
virtual ~CLogger();
//Functions to write different message types
void WriteMessage(const char *message);
void WriteError(const char *message);
void WriteWarning(const char *message);
//Function to log stuff to file
void Log(ELogMethod method, const char* fmt, ...);
//Function to log stuff to memory buffer
void QuickLog(const char *fmt, ...);
private:
CLogger();
//the two filestreams
std::ofstream m_MainLog;
std::ofstream m_DetailedLog;
//vars to hold message counts
int m_NumberOfMessages;
int m_NumberOfErrors;
int m_NumberOfWarnings;
//this holds the start of the memory buffer.
char *m_MemoryLog;
//this holds the next available place to write to.
char *m_CurrentPosition;
};
#endif