Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef INET_LOG_MACROS_H_
00010 #define INET_LOG_MACROS_H_
00011
00012 #include "ace/INet/INet_Export.h"
00013
00014 #if !defined (DLINFO)
00015 # define DLINFO ACE_TEXT("(%P|%t) [%M] - %T - ")
00016 #endif
00017
00018 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00019
00020 namespace ACE
00021 {
00022 class ACE_INET_Export INet_Log
00023 {
00024 public:
00025 INet_Log () {}
00026
00027 static unsigned int debug_level_;
00028
00029 static unsigned int Initializer (void);
00030 };
00031 }
00032
00033 ACE_END_VERSIONED_NAMESPACE_DECL
00034
00035
00036 #if !defined (INET_NTRACE)
00037 # if defined (NDEBUG)
00038 # define INET_NTRACE 1
00039 # else
00040 # define INET_NTRACE 0
00041 # endif
00042 #endif
00043
00044 #if (INET_NTRACE == 1)
00045 # if !defined (ACE_NTRACE)
00046 # define INET_TRACE(X) do {} while (0)
00047 # define INET_ENABLE_TRACE() do {} while (0)
00048 # define INET_DISABLE_TRACE() do {} while (0)
00049 # else
00050 # if (ACE_NTRACE == 0)
00051 # error INET_TRACE cannot be disabled if ACE_TRACE is enabled
00052 # else
00053 # define INET_TRACE(X) do {} while (0)
00054 # define INET_ENABLE_TRACE() do {} while (0)
00055 # define INET_DISABLE_TRACE() do {} while (0)
00056 # endif
00057 # endif
00058 #else
00059 # if !defined (ACE_HAS_TRACE)
00060 # define ACE_HAS_TRACE
00061 # endif
00062 # define INET_TRACE(X) ACE_TRACE_IMPL (X)
00063 # define INET_ENABLE_TRACE() ACE_Trace::start_tracing ()
00064 # define INET_DISABLE_TRACE() ACE_Trace::stop_tracing ()
00065 # undef DLINFO // Make log messages indent with tracing.
00066 # define DLINFO ACE_TEXT("%I(%P|%t) [%M] - %T - ")
00067 # include "ace/Trace.h"
00068 #endif
00069
00070 #if defined (INET_NLOGGING)
00071 # define INET_ERROR(L, X) do {} while (0)
00072 # define INET_DEBUG(L, X) do {} while (0)
00073 #define INET_ERROR_RETURN(L, X, Y) return (Y)
00074 #define INET_ERROR_BREAK(L, X) { break; }
00075 #else
00076 # if !defined (INET_ERROR)
00077 # define INET_ERROR(L, X) \
00078 do { \
00079 if (::ACE::INet_Log::debug_level_ >= L) \
00080 { \
00081 int const __ace_error = ACE_Log_Msg::last_error_adapter (); \
00082 ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
00083 ace___->conditional_set (__FILE__, __LINE__, -1, __ace_error); \
00084 ace___->log X; \
00085 } \
00086 } while (0)
00087 # endif
00088 # if !defined (INET_DEBUG)
00089 # define INET_DEBUG(L, X) \
00090 do { \
00091 if (::ACE::INet_Log::debug_level_ >= L) \
00092 { \
00093 int const __ace_error = ACE_Log_Msg::last_error_adapter (); \
00094 ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
00095 ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \
00096 ace___->log X; \
00097 } \
00098 } while (0)
00099 # endif
00100 # if !defined (INET_HEX_DUMP)
00101 #define INET_HEX_DUMP(L, X) \
00102 do { \
00103 if (::ACE::INet_Log::debug_level_ >= L) \
00104 { \
00105 int const __ace_error = ACE_Log_Msg::last_error_adapter (); \
00106 ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
00107 ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \
00108 ace___->log_hexdump X; \
00109 } \
00110 } while (0)
00111 #endif
00112 # if !defined (INET_ERROR_RETURN)
00113 # define INET_ERROR_RETURN(L, X, Y) \
00114 do { \
00115 if (::ACE::INet_Log::debug_level_ >= L) \
00116 { \
00117 int const __ace_error = ACE_Log_Msg::last_error_adapter (); \
00118 ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
00119 ace___->conditional_set (__FILE__, __LINE__, Y, __ace_error); \
00120 ace___->log X; \
00121 return Y; \
00122 } \
00123 } while (0)
00124 # endif
00125 # if !defined (INET_ERROR_BREAK)
00126 # define INET_ERROR_BREAK(L, X) { INET_ERROR (L, X); break; }
00127 # endif
00128 #endif
00129
00130
00131 #endif