Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tao / debug.h
blob47c3d35f77f13e2311155c63c52432ea59b5c90b
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file debug.h
7 * @author DOC Group
8 */
9 //=============================================================================
11 #ifndef TAO_DEBUG_H
12 #define TAO_DEBUG_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "tao/TAO_Export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include /**/ "tao/Versioned_Namespace.h"
23 #include "ace/Log_Category.h"
25 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
27 // These are global to simplify is use by other code, very much in
28 // particular by getopt and related argument-parsing code
30 // THREADING NOTE: don't set them except in an unthreaded environment
31 // such as process initialization. They're treated as immutable.
33 // 0 to ??; higher == more
34 extern TAO_Export unsigned int TAO_debug_level;
36 // debug messages on (1) or off (0)
37 extern TAO_Export unsigned int TAO_orbdebug;
39 extern TAO_Export ACE_Log_Category TAO_log_category;
41 TAO_END_VERSIONED_NAMESPACE_DECL
44 #if defined (ACE_NLOGGING)
45 #if !defined (TAOLIB_HEX_DUMP)
46 # define TAOLIB_HEX_DUMP(X) do {} while (0)
47 #endif
48 #if !defined (TAOLIB_ERROR_RETURN)
49 # define TAOLIB_ERROR_RETURN(X, Y) return (Y)
50 #endif
51 #if !defined (TAOLIB_ERROR)
52 # define TAOLIB_ERROR(X) do {} while (0)
53 #endif
54 #if !defined (TAOLIB_DEBUG)
55 # define TAOLIB_DEBUG(X) do {} while (0)
56 #endif
57 #else
58 #if !defined (TAOLIB_HEX_DUMP)
59 #define TAOLIB_HEX_DUMP(X) \
60 do { \
61 int const __ace_error = ACE_Log_Msg::last_error_adapter (); \
62 ACE_Log_Category_TSS *ace___ = TAO_VERSIONED_NAMESPACE_NAME::TAO_log_category.per_thr_obj(); \
63 if (ace___ == 0) break;\
64 ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \
65 ace___->log_hexdump X; \
66 } while (0)
67 #endif
68 #if !defined (TAOLIB_ERROR_RETURN)
69 #define TAOLIB_ERROR_RETURN(X, Y) \
70 do { \
71 int const __ace_error = ACE_Log_Msg::last_error_adapter (); \
72 ACE_Log_Category_TSS *ace___ = TAO_VERSIONED_NAMESPACE_NAME::TAO_log_category.per_thr_obj(); \
73 if (ace___ == 0) return Y;\
74 ace___->conditional_set (__FILE__, __LINE__, Y, __ace_error); \
75 ace___->log X; \
76 return Y; \
77 } while (0)
78 #endif
79 #if !defined (TAOLIB_ERROR)
80 #define TAOLIB_ERROR(X) \
81 do { \
82 int const __ace_error = ACE_Log_Msg::last_error_adapter (); \
83 ACE_Log_Category_TSS *ace___ = TAO_VERSIONED_NAMESPACE_NAME::TAO_log_category.per_thr_obj(); \
84 if (ace___ == 0) break;\
85 ace___->conditional_set (__FILE__, __LINE__, -1, __ace_error); \
86 ace___->log X; \
87 } while (0)
88 #endif
89 #if !defined (TAOLIB_DEBUG)
90 #define TAOLIB_DEBUG(X) \
91 do { \
92 int const __ace_error = ACE_Log_Msg::last_error_adapter (); \
93 ACE_Log_Category_TSS *ace___ = TAO_VERSIONED_NAMESPACE_NAME::TAO_log_category.per_thr_obj(); \
94 if (ace___ == 0) break;\
95 ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \
96 ace___->log X; \
97 } while (0)
98 #endif
99 #endif /* ACE_NLOGGING */
101 #include /**/ "ace/post.h"
102 #endif /* TAO_DEBUG_H */