1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
// $Id$
/**
* @file Log_Macros.h
* @author William R. Otte <wotte@dre.vanderbilt.edu>
*
* Macros used for logging in CIAO.
*/
#ifndef CIAO_LOG_MACROS_H_
#define CIAO_LOG_MACROS_H_
// default information printed with CIAO logging messages.
#include "CIAO_Logger_Export.h"
#if !defined (CLINFO)
# define CLINFO "(%P|%t) [%M] - %T - "
#endif
extern CIAO_Logger_Export unsigned int CIAO_debug_level;
// By default tracing is turned off.
#if !defined (CIAO_NTRACE)
# define CIAO_NTRACE 1
#endif /* CIAO_NTRACE */
#if (CIAO_NTRACE == 1)
# if !defined (ACE_NTRACE)
# define CIAO_TRACE(X) do {} while (0)
# define CIAO_ENABLE_TRACE() do {} while (0)
# define CIAO_DISABLE_TRACE() do {} while (0)
# else
# if (ACE_NTRACE == 0)
# error CIAO_TRACE cannot be disabled if ACE_TRACE is enabled
# else
# define CIAO_TRACE(X) do {} while (0)
# define CIAO_ENABLE_TRACE() do {} while (0)
# define CIAO_DISABLE_TRACE() do {} while (0)
# endif
# endif
#else
# if !defined (ACE_HAS_TRACE)
# define ACE_HAS_TRACE
# endif /* ACE_HAS_TRACE */
# define CIAO_TRACE(X) ACE_TRACE_IMPL(X)
# define CIAO_ENABLE_TRACE() ACE_Trace::start_tracing ()
# define CIAO_DISABLE_TRACE() ACE_Trace::stop_tracing ()
# undef CLINFO // Make log messages indent with tracing.
# define CLINFO "%I(%P|%t) [%M] - %T - "
# include "ace/Trace.h"
#endif /* CIAO_NTRACE */
#if defined (CIAO_NLOGGING)
# define CIAO_ERROR(L, X) do {} while (0)
# define CIAO_DEBUG(L, X) do {} while (0)
# define CIAO_ERROR_RETURN(L, X, Y) return (Y)
# define CIAO_ERROR_BREAK(L, X) { break; }
#else
# if !defined (CIAO_ERROR)
# define CIAO_ERROR(L, X) \
do { \
if (CIAO_debug_level >= L) \
{ \
int const __ace_error = ACE_Log_Msg::last_error_adapter (); \
ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
ace___->conditional_set (__FILE__, __LINE__, -1, __ace_error); \
ace___->log X; \
} \
} while (0)
# endif
# if !defined (CIAO_DEBUG)
# define CIAO_DEBUG(L, X) \
do { \
if (CIAO_debug_level >= L) \
{ \
int const __ace_error = ACE_Log_Msg::last_error_adapter (); \
ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \
ace___->log X; \
} \
} while (0)
# endif
# if !defined (CIAO_ERROR_RETURN)
# define CIAO_ERROR_RETURN(L, X, Y) \
do { \
if (CIAO_debug_level >= L) \
{ \
int const __ace_error = ACE_Log_Msg::last_error_adapter (); \
ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
ace___->conditional_set (__FILE__, __LINE__, Y, __ace_error); \
ace___->log X; \
} \
return Y; \
} while (0)
# endif
# if !defined (CIAO_ERROR_BREAK)
# define CIAO_ERROR_BREAK(L, X) { CIAO_ERROR (L, X); break; }
# endif
#endif
#endif
|