Go to the documentation of this file.00001
00002
00003 #include "ace/Trace.h"
00004
00005 ACE_RCSID (ace,
00006 Trace,
00007 "$Id: Trace.cpp 87823 2009-11-30 12:38:34Z johnnyw $")
00008
00009
00010 #if defined (ACE_NTRACE)
00011 #undef ACE_NTRACE
00012 #endif
00013 #define ACE_NTRACE 1
00014
00015 #include "ace/Log_Msg.h"
00016 #include "ace/Object_Manager_Base.h"
00017
00018 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00019
00020
00021
00022
00023 int ACE_Trace::nesting_indent_ = ACE_Trace::DEFAULT_INDENT;
00024
00025
00026 bool ACE_Trace::enable_tracing_ = ACE_Trace::DEFAULT_TRACING;
00027
00028 ACE_ALLOC_HOOK_DEFINE(ACE_Trace)
00029
00030 void
00031 ACE_Trace::dump (void) const
00032 {
00033 #if defined (ACE_HAS_DUMP)
00034 #endif
00035 }
00036
00037
00038
00039 bool
00040 ACE_Trace::is_tracing (void)
00041 {
00042 return ACE_Trace::enable_tracing_;
00043 }
00044
00045
00046
00047 void
00048 ACE_Trace::start_tracing (void)
00049 {
00050 ACE_Trace::enable_tracing_ = true;
00051 }
00052
00053
00054
00055 void
00056 ACE_Trace::stop_tracing (void)
00057 {
00058 ACE_Trace::enable_tracing_ = false;
00059 }
00060
00061
00062
00063 void
00064 ACE_Trace::set_nesting_indent (int indent)
00065 {
00066 ACE_Trace::nesting_indent_ = indent;
00067 }
00068
00069
00070
00071 int
00072 ACE_Trace::get_nesting_indent (void)
00073 {
00074 return ACE_Trace::nesting_indent_;
00075 }
00076
00077
00078
00079
00080 ACE_Trace::ACE_Trace (const ACE_TCHAR *n,
00081 int line,
00082 const ACE_TCHAR *file)
00083 {
00084 #if defined (ACE_NLOGGING)
00085 ACE_UNUSED_ARG (line);
00086 ACE_UNUSED_ARG (file);
00087 #endif
00088
00089 this->name_ = n;
00090
00091
00092
00093 if (ACE_Trace::enable_tracing_ && !ACE_OS_Object_Manager::starting_up ())
00094 {
00095 ACE_Log_Msg *lm = ACE_LOG_MSG;
00096 if (lm->tracing_enabled ()
00097 && lm->trace_active () == 0)
00098 {
00099 lm->trace_active (1);
00100 ACE_DEBUG ((LM_TRACE,
00101 ACE_TEXT ("%*s(%t) calling %s in file `%s' on line %d\n"),
00102 ACE_Trace::nesting_indent_ * lm->inc (),
00103 ACE_TEXT (""),
00104 this->name_,
00105 file,
00106 line));
00107 lm->trace_active (0);
00108 }
00109 }
00110 }
00111
00112
00113
00114
00115 ACE_Trace::~ACE_Trace (void)
00116 {
00117
00118
00119 if (ACE_Trace::enable_tracing_ && !ACE_OS_Object_Manager::starting_up ())
00120 {
00121 ACE_Log_Msg *lm = ACE_LOG_MSG;
00122 if (lm->tracing_enabled ()
00123 && lm->trace_active () == 0)
00124 {
00125 lm->trace_active (1);
00126 ACE_DEBUG ((LM_TRACE,
00127 ACE_TEXT ("%*s(%t) leaving %s\n"),
00128 ACE_Trace::nesting_indent_ * lm->dec (),
00129 ACE_TEXT (""),
00130 this->name_));
00131 lm->trace_active (0);
00132 }
00133 }
00134 }
00135
00136 ACE_END_VERSIONED_NAMESPACE_DECL