4 #include "ace/Log_Msg.h"
10 Trace (const ACE_TCHAR
*prefix
,
11 const ACE_TCHAR
*name
,
13 const ACE_TCHAR
*file
)
15 this->prefix_
= prefix
;
20 ACE_Log_Msg
*lm
= ACE_LOG_MSG
;
21 if (lm
->tracing_enabled ()
22 && lm
->trace_active () == 0)
27 ACE_TEXT ("%s%*s(%t) calling %s in file `%s'")
28 ACE_TEXT (" on line %d\n"),
30 Trace::nesting_indent_
* lm
->inc (),
39 void setLine (int line
)
46 ACE_Log_Msg
*lm
= ACE_LOG_MSG
;
47 if (lm
->tracing_enabled ()
48 && lm
->trace_active () == 0)
53 ACE_TEXT ("%s%*s(%t) leaving %s in file `%s'")
54 ACE_TEXT (" on line %d\n"),
56 Trace::nesting_indent_
* lm
->dec (),
66 enum { nesting_indent_
= 3 };
68 const ACE_TCHAR
*prefix_
;
69 const ACE_TCHAR
*name_
;
70 const ACE_TCHAR
*file_
;
75 // Listing 2 code/ch03
76 #define TRACE_PREFIX ACE_TEXT ("TRACE ")
84 # define TRACE_RETURN(V) return V;
85 # define TRACE_RETURN_VOID()
88 Trace ____ (TRACE_PREFIX, \
93 # define TRACE_RETURN(V) \
94 do { ____.setLine(__LINE__); return V; } while (0)
96 # define TRACE_RETURN_VOID() \
97 do { ____.setLine(__LINE__); } while (0)
101 //////////////////////////////////////////////////
103 // Listing 3 code/ch03
105 #define DEBUG_PREFIX ACE_TEXT ("DEBUG%I")
106 #define INFO_PREFIX ACE_TEXT ("INFO%I")
107 #define NOTICE_PREFIX ACE_TEXT ("NOTICE%I")
108 #define WARNING_PREFIX ACE_TEXT ("WARNING%I")
109 #define ERROR_PREFIX ACE_TEXT ("ERROR%I")
110 #define CRITICAL_PREFIX ACE_TEXT ("CRITICAL%I")
111 #define ALERT_PREFIX ACE_TEXT ("ALERT%I")
112 #define EMERGENCY_PREFIX ACE_TEXT ("EMERGENCY%I")
114 #define MY_DEBUG(X) \
115 ACE_DEBUG(( LM_DEBUG, \
119 ACE_DEBUG(( LM_INFO, \
122 #define MY_NOTICE(X) \
123 ACE_DEBUG(( LM_NOTICE, \
126 #define MY_WARNING(X) \
127 ACE_DEBUG(( LM_WARNING, \
130 #define MY_ERROR(X) \
131 ACE_DEBUG(( LM_ERROR, \
134 #define MY_CRITICAL(X) \
135 ACE_DEBUG(( LM_CRITICAL, \
138 #define MY_ALERT(X) \
139 ACE_DEBUG(( LM_ALERT, \
142 #define MY_EMERGENCY(X) \
143 ACE_DEBUG(( LM_EMERGENCY, \