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