-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebugLog.cpp
More file actions
107 lines (87 loc) · 1.83 KB
/
debugLog.cpp
File metadata and controls
107 lines (87 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
* DebugLog.cpp
*
* $Id$
*
* class doc here
*/
#include "DebugLog.h"
DebugLog *DebugLog::m_instance = 0;
DebugLog::DebugLog() : m_level(0)
{
m_instance = this;
}
void DebugLog::openLog()
{
openLog( "debug.log" );
}
void DebugLog::openLog( const string &filename )
{
instance()->m_outfile.open( filename.c_str() );
instance()->writeToLog( "<RCTGLLog>\n" );
instance()->m_level = 1;
}
void DebugLog::printTabs()
{
for( int i = 0; i < instance()->m_level; i++ )
instance()->m_outfile << "\t";
}
void DebugLog::beginTask( const string &taskName )
{
instance()->printTabs();
instance()->m_outfile << "<TASK NAME='" << taskName << "'>" << endl;
instance()->m_level++;
}
void DebugLog::endTask()
{
instance()->m_level--;
instance()->printTabs();
instance()->m_outfile << "</TASK>" << endl;
}
void DebugLog::writeToLog(const string &msg)
{
//instance()->writeToLog( msg, string() );
instance()->printTabs();
instance()->m_outfile << msg << endl;
}
/*static void DebugLog::writeToLog(const string &msg, const string &p1)
{
instance()->printTabs();
instance()->m_outfile << msg << ": " << p1 << endl;
if(validLog)
{
printTabs();
fprintf(handle, msg, p1);
fflush(handle);
}
}
void debugLog::writeToLog(char *msg, long p1)
{
if(validLog)
{
printTabs();
fprintf(handle, msg, p1);
fflush(handle);
}
}
void debugLog::writeToLog(char *msg, double p1)
{
if(validLog)
{
printTabs();
fprintf(handle, msg, p1);
fflush(handle);
}
}*/
void DebugLog::closeLog()
{
instance()->m_outfile << "</RCTGLLog> " << endl;
instance()->m_outfile.close();
/* if(validLog)
{
fprintf(handle, "</RCTGLLog>\n");
fflush(handle);
fclose(handle);
validLog = false;
}*/
}