ZenLib
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
ZenLib
Trace.h
Go to the documentation of this file.
1
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
2
*
3
* Use of this source code is governed by a zlib-style license that can
4
* be found in the License.txt file in the root of the source tree.
5
*/
6
7
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8
//
9
// Trace
10
//
11
// Provide a direct to file trace
12
//
13
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
14
15
//---------------------------------------------------------------------------
16
#ifndef ZenTraceH
17
#define ZenTraceH
18
//---------------------------------------------------------------------------
19
20
//---------------------------------------------------------------------------
21
#include <fstream>
22
#include "
ZenLib/Ztring.h
"
23
//---------------------------------------------------------------------------
24
25
namespace
ZenLib
26
{
27
28
//***************************************************************************
29
30
static
std::FILE* Trace_F;
31
static
ZenLib::Ztring
Trace;
32
static
ZenLib::Ztring
Trace2;
33
34
#ifdef TRACE
35
#undef TRACE
36
#endif //TRACE
37
38
#if 1
39
#define TRACE(_TOAPPEND)
40
#else
41
#define TRACE(_TOAPPEND) \
42
Trace.clear(); \
43
Trace2.clear(); \
44
_TOAPPEND; \
45
if (!Trace2.empty()) \
46
{ \
47
Trace+=__T(" - "); \
48
Trace+=Trace2; \
49
} \
50
Trace+=__T("\r\n"); \
51
Trace_F=std::fopen("Trace.txt", "a+t"); \
52
if(Trace_F) \
53
{ \
54
std::fwrite(Trace.To_Local().c_str(), Trace.size(), 1, Trace_F); \
55
std::fclose(Trace_F); \
56
}
57
#endif
58
59
//***************************************************************************
60
61
62
}
//NameSpace
63
64
#endif // ZenTraceH
ZenLib::Ztring
String manipulation (based on std::(w)string)
Definition:
Ztring.h:49
Ztring.h
Generated by
1.8.6