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 24... Line 24...
24
		delete m_pInstance;
24
		delete m_pInstance;
25
	}
25
	}
26
	m_pInstance = 0;
26
	m_pInstance = 0;
27
}
27
}
28
 
28
 
29
void CLog::log(const Utils::String &sLogText)
29
void CLog::log(int iLevel, const Utils::String &sLogText)
30
{
30
{
31
	CLog *pLogger = CLog::create();
31
	CLog *pLogger = CLog::create();
32
	pLogger->_log(sLogText);
32
	pLogger->_log(iLevel, sLogText);
33
}
33
}
34
 
34
 
35
void CLog::displayLog(const Utils::String &sLogText) const
35
void CLog::displayLog(int iLevel, const Utils::String &sLogText) const
36
{
36
{
37
}
37
}
38
 
38
 
39
void CLog::_log(const Utils::String &sLogText)
39
void CLog::_log(int iLevel, const Utils::String &sLogText)
40
{
40
{
-
 
41
	SLog *newLog = new SLog;
-
 
42
	newLog->sText = sLogText;
-
 
43
	newLog->iLevel = iLevel;
41
	m_lLogs.pushBack(sLogText, "");
44
	m_lLogs.push_back(newLog);
42
 
45
 
43
	this->displayLog(sLogText);
46
	this->displayLog(iLevel, sLogText);
44
}
47
}
45
 
48
 
46
void CLog::logf(const char *sLogText, ...)
49
void CLog::logf(int iLevel, const char *sLogText, ...)
47
{
50
{
48
	char buffer[10000];
51
	char buffer[10000];
49
	va_list args;
52
	va_list args;
50
	va_start (args, sLogText);
53
	va_start (args, sLogText);
51
	vsprintf (buffer, sLogText, args);
54
	vsprintf (buffer, sLogText, args);
52
	va_end (args);
55
	va_end (args);
53
 
56
 
54
	CLog::log(buffer);
57
	CLog::log(iLevel, buffer);
55
}
58
}
56
void CLog::_logf(const char *sLogText, ...)
59
void CLog::_logf(int iLevel, const char *sLogText, ...)
57
{
60
{
58
	char buffer[10000];
61
	char buffer[10000];
59
	va_list args;
62
	va_list args;
60
	va_start (args, sLogText);
63
	va_start (args, sLogText);
61
	vsprintf (buffer, sLogText, args);
64
	vsprintf (buffer, sLogText, args);
62
	va_end (args);
65
	va_end (args);
63
 
66
 
64
	this->_log(buffer);
67
	this->_log(iLevel, buffer);
65
}
68
}
66
 
69
 
67
void CLog::clear()
70
void CLog::clear()
68
{
71
{
69
	m_lLogs.clear();
72
	m_lLogs.clear(true);
70
}
73
}
71
	
74
	
72
const Utils::String &CLog::firstLog() const
75
const SLog *CLog::firstLog() const
73
{
76
{
-
 
77
	if ( !m_lLogs.Front() ) return NULL;
74
	return m_lLogs.firstStr();
78
	return m_lLogs.Front()->Data();
75
}
79
}
76
 
80
 
77
int CLog::count() const
81
int CLog::count() const
78
{
82
{
79
	return m_lLogs.size();
83
	return m_lLogs.size();