commore
1.0.6-SNAPSHOT
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Error.h
Go to the documentation of this file.
1
//
2
// Copyright (c) 2006-2014 Raphael David / CANTOR
3
//
4
5
#ifndef CMR_LOG_INCLUDED
6
#define CMR_LOG_INCLUDED
7
8
#include "
Commore.h
"
9
#include "
GlobVar.h
"
10
11
namespace
commore
12
{
16
enum
LOG_LEVEL
17
{
18
ERR_OK
,
19
ERR_FATAL
,
20
ERR_ERROR
,
21
ERR_WARNING
,
22
ERR_INFO
,
23
ERR_LOG
,
24
ERR_DEBUG
25
};
26
27
}
28
29
namespace
commore
30
{
35
class
CMREXD
Log
36
{
37
public
:
45
Log
(
const
AChar
* key,
46
LOG_LEVEL
level,
47
const
AChar
* module_name,
48
const
AChar
* unit_name,
int
line);
52
~
Log
();
53
54
public
:
58
void
add(
const
char
* a);
62
void
add(
const
void
* a);
66
void
add(
int
);
70
void
add(
double
);
74
void
add(
bool
);
75
79
commore::Log
&
operator <<
(
commore::AChar
c);
83
commore::Log
&
operator <<
(
unsigned
char
c);
87
commore::Log
&
operator <<
(
const
unsigned
char
* s);
91
commore::Log
&
operator <<
(
const
commore::AChar
* s);
95
commore::Log
&
operator <<
(
const
void
* s);
99
commore::Log
&
operator <<
(
short
i);
103
commore::Log
&
operator <<
(
commore::Int
i);
108
commore::Log
&
operator <<
(
long
i);
113
commore::Log
&
operator <<
(
commore::Long
i);
117
commore::Log
&
operator <<
(
unsigned
short
i);
121
commore::Log
&
operator <<
(
unsigned
int
i);
126
commore::Log
&
operator <<
(
unsigned
long
i);
130
commore::Log
&
operator <<
(
float
i);
134
commore::Log
&
operator <<
(
double
i);
138
commore::Log
&
operator <<
(
bool
i);
142
commore::Log
&
operator <<
(
const
commore::TimeDate
& t);
146
commore::Log
&
operator <<
(
const
commore::ListTimeDate
& t);
150
commore::Log
&
operator <<
(
const
commore::TimePeriod
& t);
154
commore::Log
&
operator <<
(
const
commore::ListTimePeriod
& t);
158
commore::Log
&
operator <<
(
const
commore::Blob
& t);
162
commore::Log
&
operator <<
(
const
commore::ListBlob
& t);
166
commore::Log
&
operator <<
(
const
commore::Tuple
& t);
170
commore::Log
&
operator <<
(
const
commore::ListTuple
& t);
174
commore::Log
&
operator <<
(
const
commore::Symbol
& s);
178
commore::Log
&
operator <<
(
const
commore::ListSymbol
& s);
182
commore::Log
&
operator <<
(
const
commore::StringBuffer
& t);
186
commore::Log
&
operator <<
(
const
commore::AString
& t);
187
// commore::Log& operator << (const commore::String& t);
191
commore::Log
&
operator <<
(
const
commore::ListAString
& t);
195
commore::Log
&
operator <<
(
const
commore::ListString
& t);
196
200
commore::Log
&
operator <<
(
const
commore::ListBool
& t);
204
commore::Log
&
operator <<
(
const
commore::ListInt
& t);
208
commore::Log
&
operator <<
(
const
commore::ListLong
& t);
212
commore::Log
&
operator <<
(
const
commore::ListFloat
& t);
216
commore::Log
&
operator <<
(
const
commore::ListDouble
& t);
217
221
commore::Log
&
operator <<
(
const
commore::ArrayInt
& t);
225
commore::Log
&
operator <<
(
const
commore::ArrayLong
& t);
229
commore::Log
&
operator <<
(
const
commore::ArrayFloat
& t);
233
commore::Log
&
operator <<
(
const
commore::ArrayDouble
& t);
237
commore::Log
&
operator <<
(
const
commore::ListArrayInt
& t);
241
commore::Log
&
operator <<
(
const
commore::ListArrayLong
& t);
245
commore::Log
&
operator <<
(
const
commore::ListArrayFloat
& t);
249
commore::Log
&
operator <<
(
const
commore::ListArrayDouble
& t);
250
255
static
const
AString
& toString(
Double
val,
AString
& dst);
260
static
const
AString
& toString(
Float
val,
AString
& dst);
265
static
const
AString
& toString(
Long
val,
AString
& dst);
270
static
const
AString
& toString(
Int
val,
AString
& dst);
275
static
const
AString
& toString(
Bool
val,
AString
& dst);
276
277
private
:
281
LOG_LEVEL
level_;
285
const
AChar
* key_;
286
const
AChar
* module_name_;
287
const
AChar
* unit_name_;
291
int
line_;
292
struct
Arg
;
296
Arg
* args_;
297
};
298
}
299
300
305
#define CMR_LOG(msg) if (cmr_log_flag.get() > 0) commore::Log(msg, commore::ERR_LOG, cmr_log_flag.get_module(), cmr_log_flag.get_name(), __LINE__)
306
#define CMR_LOG2(msg) if (cmr_log_flag.get() > 1) commore::Log(msg, commore::ERR_LOG, cmr_log_flag.get_module(), cmr_log_flag.get_name(), __LINE__)
311
#define CMR_LOG3(msg) if (cmr_log_flag.get() > 2) commore::Log(msg, commore::ERR_LOG, cmr_log_flag.get_module(), cmr_log_flag.get_name(), __LINE__)
316
321
#define CMR_DLOG(msg) commore::Log(msg, commore::ERR_LOG, cmr_log_flag.get_module(), cmr_log_flag.get_name(), __LINE__)
322
#define CMR_DLOG2(msg) commore::Log(msg, commore::ERR_LOG, cmr_log_flag.get_module(), cmr_log_flag.get_name(), __LINE__)
327
#define CMR_DLOG3(msg) commore::Log(msg, commore::ERR_LOG, cmr_log_flag.get_module(), cmr_log_flag.get_name(), __LINE__)
332
337
#define CMR_INFO(msg) commore::Log(msg, commore::ERR_INFO, cmr_log_flag.get_module(), cmr_log_flag.get_name(), __LINE__)
338
#ifdef _DEBUG
343
#define CMR_DEBUG(msg) commore::Log(msg, commore::ERR_DEBUG, cmr_log_flag.get_module(), cmr_log_flag.get_name(), __LINE__)
344
#else
345
#define CMR_DEBUG(msg) if (cmr_log_flag.get() > 1) commore::Log(msg, commore::ERR_DEBUG, cmr_log_flag.get_module(), cmr_log_flag.get_name(), __LINE__)
346
#endif
347
352
#define CMR_ERROR(msg) commore::Log(msg, commore::ERR_ERROR, cmr_log_flag.get_module(), cmr_log_flag.get_name(), __LINE__)
353
#define CMR_WARNING(msg) commore::Log(msg, commore::ERR_WARNING, cmr_log_flag.get_module(), cmr_log_flag.get_name(), __LINE__)
358
359
363
#define CMR_LOG_DECLARE(name) static commore::GlobVarLog& cmr_log_flag_##name() { static commore::GlobVarLog r(CMR_MODULE_NAME, #name); return r; }
364
#define CMR_CHECK_NLOG(n,level) (cmr_log_flag_##n().get() > level)
368
374
#define CMR_NLOG(n,msg) if (CMR_CHECK_NLOG(n,0)) commore::Log(msg, commore::ERR_LOG, cmr_log_flag_##n().get_module(), cmr_log_flag_##n().get_name(), __LINE__)
375
#define CMR_NLOG2(n,msg) if (CMR_CHECK_NLOG(n,1)) commore::Log(msg, commore::ERR_LOG, cmr_log_flag_##n().get_module(), cmr_log_flag_##n().get_name(), __LINE__)
381
#define CMR_NLOG3(n,msg) if (CMR_CHECK_NLOG(n,2)) commore::Log(msg, commore::ERR_LOG, cmr_log_flag_##n().get_module(), cmr_log_flag_##n().get_name(), __LINE__)
387
#define CMR_NLOG4(n,msg) if (CMR_CHECK_NLOG(n,3)) commore::Log(msg, commore::ERR_LOG, cmr_log_flag##n().get_module(), cmr_log_flag##n().get_name(), __LINE__)
393
394
395
396
397
398
399
#endif
400
commore::ERR_WARNING
Definition:
Error.h:21
commore::ERR_LOG
Definition:
Error.h:23
commore::Tuple
Definition:
Tuple.h:29
commore::AString
Definition:
AString.h:39
commore::Bool
bool Bool
Definition:
Type.h:35
commore::TimePeriod
Definition:
Time.h:21
commore::List
Definition:
List.h:23
Commore.h
commore::Blob
Definition:
Blob.h:18
commore::StringBuffer
Definition:
StringBuffer.h:21
commore::ERR_FATAL
Definition:
Error.h:19
commore::Double
double Double
Definition:
Type.h:46
commore::Symbol
Definition:
Symbol.h:18
commore::AChar
char AChar
Definition:
Type.h:65
commore::ERR_ERROR
Definition:
Error.h:20
CMREXD
#define CMREXD
Definition:
Compiler.h:22
commore::LOG_LEVEL
LOG_LEVEL
Definition:
Error.h:16
commore::ERR_DEBUG
Definition:
Error.h:24
commore::Log
Definition:
Error.h:35
commore::ERR_INFO
Definition:
Error.h:22
commore::Int
int Int
Definition:
Type.h:37
commore::Array
Definition:
Array.h:21
commore::Log::Arg
Definition:
Log.cpp:33
commore::ERR_OK
Definition:
Error.h:18
commore::Float
float Float
Definition:
Type.h:45
commore::Long
long long Long
Definition:
Type.h:43
commore::TimeDate
Definition:
Time.h:261
GlobVar.h
operator<<
CMREXD commore::OBStream & operator<<(commore::OBStream &o, const commore::AString &s)
Definition:
AString.cpp:19
commore
Error.h
Generated on Thu Dec 1 2016 16:59:16 for commore by
1.8.7