A C++ trace facility that keeps track of which methods are entered and exited. More...
#include <Trace.h>
Public Member Functions | |
| ACE_Trace (const ACE_TCHAR *n, int line=0, const ACE_TCHAR *file=ACE_TEXT("")) | |
| ~ACE_Trace (void) | |
| void | dump (void) const |
| Dump the state of an object. | |
Static Public Member Functions | |
| static bool | is_tracing (void) |
| Determine if tracing is enabled or not. | |
| static void | start_tracing (void) |
| Enable the tracing facility. | |
| static void | stop_tracing (void) |
| Disable the tracing facility. | |
| static void | set_nesting_indent (int indent) |
| Change the nesting indentation level. | |
| static int | get_nesting_indent (void) |
| Get the nesting indentation level. | |
Private Types | |
| enum | { DEFAULT_INDENT = 3, DEFAULT_TRACING = 1 } |
Default values. More... | |
Private Attributes | |
| const ACE_TCHAR * | name_ |
| Name of the method we are in. | |
Static Private Attributes | |
| static int | nesting_indent_ |
| Keeps track of how far to indent per trace call. | |
| static bool | enable_tracing_ |
| Is tracing enabled? | |
A C++ trace facility that keeps track of which methods are entered and exited.
This class uses C++ constructors and destructors to automate the ACE_Trace nesting. In addition, thread-specific storage is used to enable multiple threads to work correctly.
Definition at line 36 of file Trace.h.
anonymous enum [private] |
Perform the first part of the trace, which prints out the string N, the LINE, and the ACE_FILE as the function is entered.
Definition at line 80 of file Trace.cpp.
{
#if defined (ACE_NLOGGING)
ACE_UNUSED_ARG (line);
ACE_UNUSED_ARG (file);
#endif /* ACE_NLOGGING */
this->name_ = n;
// If ACE has not yet been initialized, don't try to trace... there's
// too much stuff not yet initialized.
if (ACE_Trace::enable_tracing_ && !ACE_OS_Object_Manager::starting_up ())
{
ACE_Log_Msg *lm = ACE_LOG_MSG;
if (lm->tracing_enabled ()
&& lm->trace_active () == 0)
{
lm->trace_active (1);
ACE_DEBUG ((LM_TRACE,
ACE_TEXT ("%*s(%t) calling %s in file `%s' on line %d\n"),
ACE_Trace::nesting_indent_ * lm->inc (),
ACE_TEXT (""),
this->name_,
file,
line));
lm->trace_active (0);
}
}
}
| ACE_Trace::~ACE_Trace | ( | void | ) |
Perform the second part of the trace, which prints out the NAME as the function is exited.
Definition at line 115 of file Trace.cpp.
{
// If ACE has not yet been initialized, don't try to trace... there's
// too much stuff not yet initialized.
if (ACE_Trace::enable_tracing_ && !ACE_OS_Object_Manager::starting_up ())
{
ACE_Log_Msg *lm = ACE_LOG_MSG;
if (lm->tracing_enabled ()
&& lm->trace_active () == 0)
{
lm->trace_active (1);
ACE_DEBUG ((LM_TRACE,
ACE_TEXT ("%*s(%t) leaving %s\n"),
ACE_Trace::nesting_indent_ * lm->dec (),
ACE_TEXT (""),
this->name_));
lm->trace_active (0);
}
}
}
| void ACE_Trace::dump | ( | void | ) | const |
| int ACE_Trace::get_nesting_indent | ( | void | ) | [static] |
Get the nesting indentation level.
Definition at line 72 of file Trace.cpp.
{
return ACE_Trace::nesting_indent_;
}
| bool ACE_Trace::is_tracing | ( | void | ) | [static] |
Determine if tracing is enabled or not.
Definition at line 40 of file Trace.cpp.
{
return ACE_Trace::enable_tracing_;
}
| void ACE_Trace::set_nesting_indent | ( | int | indent | ) | [static] |
Change the nesting indentation level.
Definition at line 64 of file Trace.cpp.
{
ACE_Trace::nesting_indent_ = indent;
}
| void ACE_Trace::start_tracing | ( | void | ) | [static] |
Enable the tracing facility.
Definition at line 48 of file Trace.cpp.
{
ACE_Trace::enable_tracing_ = true;
}
| void ACE_Trace::stop_tracing | ( | void | ) | [static] |
Disable the tracing facility.
Definition at line 56 of file Trace.cpp.
{
ACE_Trace::enable_tracing_ = false;
}
bool ACE_Trace::enable_tracing_ [static, private] |
const ACE_TCHAR* ACE_Trace::name_ [private] |
int ACE_Trace::nesting_indent_ [static, private] |
1.7.0