forked from Smorodov/Multitarget-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.cpp
More file actions
59 lines (49 loc) · 1.2 KB
/
debug.cpp
File metadata and controls
59 lines (49 loc) · 1.2 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
/* This software is distributed under the GNU Lesser General Public License */
//==========================================================================
//
// debug.cpp
//
//==========================================================================
// $Id: debug.cpp,v 1.10 2001/11/07 13:58:09 pick Exp $
#include <GTL/debug.h>
#include <fstream>
#include <cstdarg>
#include <cstdio>
__GTL_BEGIN_NAMESPACE
std::ostream* GTL_debug::GTLerr = 0;
void GTL_debug::debug_message (const char* message, ...)
{
#ifdef _DEBUG
va_list arg_list;
va_start(arg_list, message);
char buf[1024];
vsprintf(buf, message, arg_list);
if (GTLerr) {
os() << buf;
}
#endif
}
void GTL_debug::init_debug ()
{
if (!GTLerr) {
#ifdef __GTL_MSVCC
GTLerr = new std::ofstream("ERRLOG.txt", std::ios::out | std::ios::app);
#else
GTLerr = &std::cerr;
#endif
}
}
void GTL_debug::close_debug ()
{
if (GTLerr) {
#ifdef __GTL_MSVCC
((std::ofstream*) GTLerr)->close();
delete GTLerr;
GTLerr = 0;
#endif
}
}
__GTL_END_NAMESPACE
//--------------------------------------------------------------------------
// end of file
//--------------------------------------------------------------------------