Rev 8 | Rev 10 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#pragma once
#include "../Utils/StringList.h"
#include <vector>
#include <stdarg.h>
typedef struct {
Utils::String sText;
} SLog;
class SPKEXPORT CLog
{
public:
typedef Utils::CStringList LogList;
protected:
// private constructor
CLog(void);
virtual ~CLog(void);
private:
LogList m_lLogs;
public:
static CLog *m_pInstance;
static CLog *create();
static void release();
static void log(const Utils::String &sLogText);
static void logf(const char *sLogText, ...);
void _log(const Utils::String &sLogText);
void _logf(const char *sLogText, ...);
virtual void displayLog(const Utils::String &sLogText) const;
void clear();
const Utils::String &firstLog() const;
int count() const;
};
//TODO: move this
class SPKEXPORT CConsoleLog : public CLog
{
public:
static CLog *create()
{
if ( !CLog::m_pInstance ) {
CLog::m_pInstance = new CConsoleLog();
}
return CLog::m_pInstance;
}
virtual ~CConsoleLog(void)
{
}
virtual void displayLog(const Utils::String &sLogText) const
{
printf("%s\n", sLogText.c_str());
}
};