Subversion Repositories spk

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
#pragma once
2
 
8 cycrow 3
#include "../Utils/StringList.h"
1 cycrow 4
#include <vector>
8 cycrow 5
#include <stdarg.h>
1 cycrow 6
 
8 cycrow 7
 
1 cycrow 8
typedef struct {
8 cycrow 9
	Utils::String	sText;
1 cycrow 10
} SLog;
11
 
7 cycrow 12
class SPKEXPORT CLog
1 cycrow 13
{
14
public:
9 cycrow 15
	typedef Utils::CStringList LogList;
7 cycrow 16
 
17
protected:
18
	// private constructor
19
	CLog(void);
20
	virtual ~CLog(void);
21
 
22
private:
23
	LogList	m_lLogs;
24
 
25
public:
1 cycrow 26
	static CLog *m_pInstance;
27
	static CLog *create();
28
	static void release();
29
 
8 cycrow 30
	static void log(const Utils::String &sLogText);
7 cycrow 31
	static void logf(const char *sLogText, ...);
8 cycrow 32
	void _log(const Utils::String &sLogText);
7 cycrow 33
	void _logf(const char *sLogText, ...);
1 cycrow 34
 
8 cycrow 35
	virtual void displayLog(const Utils::String &sLogText) const;
1 cycrow 36
 
7 cycrow 37
	void clear();
9 cycrow 38
	const Utils::String &firstLog() const;
39
	int count() const;
1 cycrow 40
};
7 cycrow 41
 
42
//TODO: move this
43
class SPKEXPORT CConsoleLog : public CLog 
44
{
45
public:
46
	static CLog *create()
47
	{
48
		if ( !CLog::m_pInstance ) {
49
			CLog::m_pInstance = new CConsoleLog();
50
		}
51
		return CLog::m_pInstance;
52
	}
53
 
54
	virtual ~CConsoleLog(void)
55
	{
56
	}
8 cycrow 57
	virtual void displayLog(const Utils::String &sLogText) const
7 cycrow 58
	{
8 cycrow 59
		printf("%s\n", sLogText.c_str());
7 cycrow 60
	}
61
};