version 1.35, 2008/05/15 17:24:34
|
version 1.40, 2008/09/03 17:48:05
|
|
|
enum TRACE_FACILITY_INDEX | enum TRACE_FACILITY_INDEX |
{ | { |
TRACE_FACILITY_FILE = 0, | TRACE_FACILITY_FILE = 0, |
TRACE_FACILITY_LOG = 1 |
TRACE_FACILITY_LOG = 1, |
|
TRACE_FACILITY_MEMORY = 2 |
}; | }; |
| |
| |
|
|
*/ | */ |
static Uint32 setTraceFacility(const String& traceFacility); | static Uint32 setTraceFacility(const String& traceFacility); |
| |
|
/** Get trace facility currently in use |
|
@return TRACE_FACILITY_FILE - if trace facility is file |
|
TRACE_FACILITY_LOG - if trace facility is the log |
|
*/ |
|
static Uint32 getTraceFacility(); |
|
|
|
/** Set buffer size to be used for the memory tracing facility |
|
@param bufferSize buffer size in Kbyte to be used for memory tracing |
|
@return true if function was successfully. |
|
*/ |
|
static Boolean setTraceMemoryBufferSize(Uint32 bufferSize); |
|
|
|
/** Flushes the trace buffer to traceFilePath. This method will only |
|
have an effect when traceFacility=Memory. |
|
*/ |
|
static void flushTrace(); |
|
|
/** Traces method entry. | /** Traces method entry. |
@param token TracerToken | @param token TracerToken |
@param fileName filename of the trace originator | @param fileName filename of the trace originator |
|
|
static const Uint32 _STRLEN_MAX_UNSIGNED_INT; | static const Uint32 _STRLEN_MAX_UNSIGNED_INT; |
static const Uint32 _STRLEN_MAX_PID_TID; | static const Uint32 _STRLEN_MAX_PID_TID; |
AutoArrayPtr<Boolean> _traceComponentMask; | AutoArrayPtr<Boolean> _traceComponentMask; |
|
Uint32 _traceMemoryBufferSize; |
Uint32 _traceFacility; | Uint32 _traceFacility; |
//Is true if any components are set at the component mask | //Is true if any components are set at the component mask |
Boolean _componentsAreSet; | Boolean _componentsAreSet; |
Uint32 _traceLevelMask; | Uint32 _traceLevelMask; |
AutoPtr<TraceHandler> _traceHandler; |
TraceHandler* _traceHandler; |
String _moduleName; | String _moduleName; |
static Tracer* _tracerInstance; | static Tracer* _tracerInstance; |
| |
|
|
// Factory function to create an instance of the matching trace handler | // Factory function to create an instance of the matching trace handler |
// for the given type of traceFacility. | // for the given type of traceFacility. |
// @param traceFacility type of trace handler to create | // @param traceFacility type of trace handler to create |
// @return an instance of a trace handler class. For invalid trace |
void _setTraceHandler( Uint32 traceFacility ); |
// facilities always creates a traceFileHandler. |
|
TraceHandler* getTraceHandler( Uint32 traceFacility ); |
|
| |
// Traces the given message. Overloaded to include the file name and the | // Traces the given message. Overloaded to include the file name and the |
// line number as one of the parameters. | // line number as one of the parameters. |
|
|
inline Uint32 Tracer::setTraceFacility(const String& traceComponents) | inline Uint32 Tracer::setTraceFacility(const String& traceComponents) |
{ | { |
// empty function | // empty function |
|
return 0; |
|
} |
|
|
|
inline Uint32 Tracer::getTraceFacility() |
|
{ |
|
// empty function |
|
return 0; |
|
} |
|
|
|
inline Boolean Tracer::setTraceMemoryBufferSize(Uint32 bufferSize) |
|
{ |
|
// empty function |
|
return true; |
|
} |
|
|
|
inline void Tracer::flushTrace() |
|
{ |
|
// empty function |
|
return; |
} | } |
| |
#endif /* PEGASUS_REMOVE_TRACE */ | #endif /* PEGASUS_REMOVE_TRACE */ |
|
|
| |
# define PEG_METHOD_ENTER(comp,meth) | # define PEG_METHOD_ENTER(comp,meth) |
# define PEG_METHOD_EXIT() | # define PEG_METHOD_EXIT() |
# define PEG_TRACE_STRING(comp,level,string) |
|
# define PEG_TRACE(VAR_ARGS) | # define PEG_TRACE(VAR_ARGS) |
# define PEG_TRACE_CSTRING(comp,level,chars) | # define PEG_TRACE_CSTRING(comp,level,chars) |
| |
#else /* PEGASUS_REMOVE_TRACE */ | #else /* PEGASUS_REMOVE_TRACE */ |
| |
|
// remover trace code for method enter/exit |
|
# ifdef PEGASUS_REMOVE_METHODTRACE |
|
# define PEG_METHOD_ENTER(comp,meth) |
|
# define PEG_METHOD_EXIT() |
|
# else |
# define PEG_METHOD_ENTER(comp, meth) \ | # define PEG_METHOD_ENTER(comp, meth) \ |
TracerToken __tracerToken; \ | TracerToken __tracerToken; \ |
__tracerToken.method = 0; \ | __tracerToken.method = 0; \ |
|
|
Tracer::traceExit(__tracerToken PEGASUS_COMMA_FILE_LINE); \ | Tracer::traceExit(__tracerToken PEGASUS_COMMA_FILE_LINE); \ |
} \ | } \ |
while (0) | while (0) |
|
# endif |
// Macro for Trace String. the do construct allows this to appear |
|
// as a single statement. |
|
# define PEG_TRACE_STRING(comp, level, string) \ |
|
do \ |
|
{ \ |
|
if (Tracer::isTraceOn()) \ |
|
{ \ |
|
if (Tracer::isTraceEnabled(comp, level)) \ |
|
{ \ |
|
Tracer::traceCString(PEGASUS_FILE_LINE_COMMA \ |
|
comp, \ |
|
(const char*) (string).getCString()); \ |
|
} \ |
|
} \ |
|
} \ |
|
while (0) |
|
| |
// Macro to trace character lists. the do construct allows this to appear | // Macro to trace character lists. the do construct allows this to appear |
// as a single statement. | // as a single statement. |