- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
#define TRACE_VAR ATraceClass *mTrace
#define TRACE_VAR_INIT mTrace = ATraceClass::getInstance()
class ATraceClass {
public:
void log(int severity, const char *format, ...);
/* ... */
}
class ATraceUser {
public:
ATraceUser::ATraceUser() {
TRACE_VAR_INIT;
}
int SomeMethod1();
/* ... */
TRACE_VAR;
}
int ATraceUser::SomeMethod1()
{
/* ... */
if (errorCondition)
{
return mTrace->log( ERR, "Something went terribly"\
"wrong when doing the operation %s\n",\
mOperation),-1;
}
/* ... */
}