Subversion Repositories spk

Rev

Rev 9 | Rev 50 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9 Rev 10
Line 5... Line 5...
5
#include <stdarg.h>
5
#include <stdarg.h>
6
 
6
 
7
 
7
 
8
typedef struct {
8
typedef struct {
9
	Utils::String	sText;
9
	Utils::String	sText;
-
 
10
	int				iLevel;
10
} SLog;
11
} SLog;
11
 
12
 
12
class SPKEXPORT CLog
13
class SPKEXPORT CLog
13
{
14
{
14
public:
15
public:
15
	typedef Utils::CStringList LogList;
16
	typedef CLinkList<SLog> LogList;
-
 
17
	typedef CListNode<SLog>* LogNode;
-
 
18
 
-
 
19
	enum LogLevel {
-
 
20
		Log_All			= 0,
-
 
21
		Log_Normal		= 1,
-
 
22
		Log_IO			= 2,
-
 
23
		Log_EditPackage = 4,
-
 
24
		Log_File		= 8,
-
 
25
		Log_Read		= 16,
-
 
26
	};
16
 
27
 
17
protected:
28
protected:
18
	// private constructor
29
	// private constructor
19
	CLog(void);
30
	CLog(void);
20
	virtual ~CLog(void);
31
	virtual ~CLog(void);
Line 25... Line 36...
25
public:
36
public:
26
	static CLog *m_pInstance;
37
	static CLog *m_pInstance;
27
	static CLog *create();
38
	static CLog *create();
28
	static void release();
39
	static void release();
29
 
40
 
30
	static void log(const Utils::String &sLogText);
41
	static void log(int iLevel, const Utils::String &sLogText);
31
	static void logf(const char *sLogText, ...);
42
	static void logf(int iLevel, const char *sLogText, ...);
32
	void _log(const Utils::String &sLogText);
43
	void _log(int iLevel, const Utils::String &sLogText);
33
	void _logf(const char *sLogText, ...);
44
	void _logf(int iLevel, const char *sLogText, ...);
34
 
45
 
35
	virtual void displayLog(const Utils::String &sLogText) const;
46
	virtual void displayLog(int iLevel, const Utils::String &sLogText) const;
36
 
47
 
37
	void clear();
48
	void clear();
38
	const Utils::String &firstLog() const;
49
	const SLog *firstLog() const;
39
	int count() const;
50
	int count() const;
40
};
51
};
41
 
52
 
42
//TODO: move this
53
//TODO: move this
43
class SPKEXPORT CConsoleLog : public CLog 
54
class SPKEXPORT CConsoleLog : public CLog 
Line 52... Line 63...
52
	}
63
	}
53
 
64
 
54
	virtual ~CConsoleLog(void)
65
	virtual ~CConsoleLog(void)
55
	{
66
	{
56
	}
67
	}
57
	virtual void displayLog(const Utils::String &sLogText) const
68
	virtual void displayLog(int iLevel, const Utils::String &sLogText) const
58
	{
69
	{
59
		printf("%s\n", sLogText.c_str());
70
		printf("%s\n", sLogText.c_str());
60
	}
71
	}
61
};
72
};