00001 #ifndef _IT_BUS_LOGGING_SUPPORT_H_
00002 #define _IT_BUS_LOGGING_SUPPORT_H_
00003
00004
00005
00006
00007
00008 #ifdef _IT_BUS_BUS_LOGGER_H_
00009 #error logging_support.h should not be used with bus_logger.h
00010 #endif
00011
00012 #include <stdio.h>
00013 #include <stdarg.h>
00014
00015 #include <it_bus/api_defines.h>
00016 #include <it_dsa/vector.h>
00017 #include <it_bus/types.h>
00018 #include <it_bus/logging_defs.h>
00019
00020 namespace IT_Bus
00021 {
00022 namespace Logging
00023 {
00024 class ServiceNameRetriever;
00025 }
00026 }
00027
00028 namespace CORBA
00029 {
00030 class ORB;
00031 }
00032
00033 namespace IT_Logging
00034 {
00035 class EventLog;
00036 }
00037
00038 extern "C"
00039 {
00040 extern IT_AFC_API IT_TraceLevel it_g_log_filter;
00041 extern IT_AFC_API IT_TraceLevel it_get_subsystem_log_filter(const char * subsystem);
00042
00043 void IT_AFC_API it_set_global_log_filter(IT_TraceLevel trace_level);
00044
00045 void IT_AFC_API it_set_logging_default_ORB(CORBA::ORB* orb);
00046
00047 void IT_AFC_API
00048 it_write_log_record(
00049 IT_Logging::EventLog* event_log,
00050 IT_Bus::Logging::ServiceNameRetriever* snr,
00051 const char * subsystem,
00052 IT_TraceLevel trace_level,
00053 const char* description,
00054 ...);
00055
00056 void IT_AFC_API
00057 it_write_log_record_with_CDATA(
00058 IT_Logging::EventLog* event_log,
00059 IT_Bus::Logging::ServiceNameRetriever* snr,
00060 const char * subsystem,
00061 IT_TraceLevel trace_level,
00062 const char* description,
00063 const char* data_buffer,
00064 long buffer_size
00065 );
00066
00067 void IT_AFC_API
00068 it_write_log_record_with_binary(
00069 IT_Logging::EventLog* event_log,
00070 IT_Bus::Logging::ServiceNameRetriever* snr,
00071 const char * subsystem,
00072 IT_TraceLevel trace_level,
00073 const char* description,
00074 const char* data_buffer,
00075 long buffer_size
00076 );
00077
00078 IT_Bool IT_AFC_API
00079 _it_test_ignore_service(
00080 char* serviceNameBuffer,
00081 const char* subsystem,
00082 int sn_len,
00083 IT_Bool& _it_ignore,
00084 IT_Bool& _it_init_done
00085 );
00086 }
00087
00088
00089
00090
00091 #define IT_LOG_BUFFER(event_log, Entry, Length) \
00092 if ((it_g_log_filter & IT_TRACE_BUFFER) != 0) \
00093 { \
00094 it_write_log_record_with_binary(event_log, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE_BUFFER, "Buffer Output", Entry, Length); \
00095 }
00096
00097 #define IT_LOG_CDATA(event_log, description, Entry) \
00098 if ((it_g_log_filter & IT_TRACE_BUFFER) != 0) \
00099 { \
00100 it_write_log_record_with_CDATA(event_log, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE_BUFFER, description, Entry, 0); \
00101 }
00102
00103 #define IT_LOG_CDATA_SIZE(event_log, description, Entry, Size) \
00104 if ((it_g_log_filter & IT_TRACE_BUFFER) != 0) \
00105 { \
00106 it_write_log_record_with_CDATA(event_log, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE_BUFFER, description, Entry, Size); \
00107 }
00108
00109 #define IT_LOG_CDATA_BINARY_BUFFER(event_log, description, bbData) \
00110 if ((it_g_log_filter & IT_TRACE_BUFFER) != 0) \
00111 { \
00112 it_write_log_record_with_binary(event_log, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE_BUFFER, description, bbData.get_const_pointer(), bbData.get_size()); \
00113 }
00114
00115
00116
00117
00118 #define IT_LOG_GUARDED0(event_log, snr, subsystem, trace_level, description) \
00119 if ((it_g_log_filter & trace_level) != 0) \
00120 it_write_log_record(event_log, snr, subsystem, trace_level, description);
00121
00122 #define IT_LOG_GUARDED(event_log, snr, subsystem, trace_level, description) \
00123 IT_LOG_GUARDED0(event_log, snr, subsystem, trace_level, description)
00124
00125 #define IT_LOG_GUARDED1(event_log, snr, subsystem, trace_level, description, Arg1) \
00126 if ((it_g_log_filter & trace_level) != 0) \
00127 { \
00128 it_write_log_record(event_log, snr, subsystem, trace_level, description, Arg1); \
00129 }
00130
00131 #define IT_LOG_GUARDED2(event_log, snr, subsystem, trace_level, description, Arg1, Arg2) \
00132 if ((it_g_log_filter & trace_level) != 0) \
00133 { \
00134 it_write_log_record(event_log, snr, subsystem, trace_level, description, Arg1, Arg2); \
00135 }
00136
00137 #define IT_LOG_GUARDED3(event_log, snr, subsystem, trace_level, description, Arg1, Arg2, Arg3) \
00138 if ((it_g_log_filter & trace_level) != 0) \
00139 { \
00140 it_write_log_record(event_log, snr, subsystem, trace_level, description, Arg1, Arg2, Arg3); \
00141 }
00142
00143 #define IT_LOG_GUARDED4(event_log, snr, subsystem, trace_level, description, Arg1, Arg2, Arg3, Arg4) \
00144 if ((it_g_log_filter & trace_level) != 0) \
00145 { \
00146 it_write_log_record(event_log, snr, subsystem, trace_level, description, Arg1, Arg2, Arg3, Arg4); \
00147 }
00148
00149 #define IT_LOG_GUARDED5(event_log, snr, subsystem, trace_level, description, Arg1, Arg2, Arg3, Arg4, Arg5) \
00150 if ((it_g_log_filter & trace_level) != 0) \
00151 { \
00152 it_write_log_record(event_log, snr, subsystem, trace_level, description, Arg1, Arg2, Arg3, Arg4, Arg5); \
00153 }
00154
00155
00156
00157
00158
00159 #define BEGIN_TRACE(trace_level) \
00160 if ((it_g_log_filter & trace_level) != 0) \
00161 {
00162
00163 #define BEGIN_SUBSYSTEM_TRACE(subsystem_filter, trace_level) \
00164 if ((subsystem_filter & trace_level) != 0) \
00165 {
00166
00167 #define END_TRACE \
00168 }
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178 #define TRACELOGBUFFER(Entry, Length) \
00179 if ((it_g_log_filter & IT_TRACE_BUFFER) != 0) \
00180 { \
00181 it_write_log_record_with_binary(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE_BUFFER, "Buffer Output", Entry, Length); \
00182 }
00183
00184 #define TRACELOG_CDATA(description, Entry) \
00185 if ((it_g_log_filter & IT_TRACE_BUFFER) != 0) \
00186 { \
00187 it_write_log_record_with_CDATA(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE_BUFFER, description, Entry, 0); \
00188 }
00189
00190 #define TRACELOG_CDATA_SIZE(description, Entry, Size) \
00191 if ((it_g_log_filter & IT_TRACE_BUFFER) != 0) \
00192 { \
00193 it_write_log_record_with_CDATA(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE_BUFFER, description, Entry, Size); \
00194 }
00195
00196 #define SUBSYSTEM_TRACELOG_CDATA_SIZE(subsystem, subsystem_filter, priority, description, Entry, Size) \
00197 if ((subsystem_filter & priority) != 0) \
00198 { \
00199 it_write_log_record_with_CDATA(0, 0, subsystem , IT_TRACE_BUFFER, description, Entry, Size); \
00200 }
00201
00202
00203 #define SUBSYSTEM_TRACELOG(subsystem, subsystem_filter, priority, description) \
00204 if ((subsystem_filter & priority) != 0) \
00205 { \
00206 it_write_log_record(0, 0, subsystem , IT_TRACE_BUFFER, description); \
00207 }
00208
00209 #define TRACELOG_CDATA_BINARY_BUFFER(description, bbData) \
00210 if ((it_g_log_filter & IT_TRACE_BUFFER) != 0) \
00211 { \
00212 it_write_log_record_with_binary(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE_BUFFER, description, bbData.get_const_pointer(), bbData.get_size()); \
00213 }
00214
00215
00216
00217 #define BEGIN_INTERNAL_METHOD(Name) \
00218 const char *FuncName = Name; \
00219 if ((it_g_log_filter & IT_TRACE_METHODS_INTERNAL) != 0) \
00220 it_write_log_record(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE_METHODS_INTERNAL, FuncName);
00221
00222 #define END_INTERNAL_METHOD
00223
00224 #define BEGIN_METHOD(Name) \
00225 const char *FuncName = Name; \
00226 if ((it_g_log_filter & IT_TRACE_METHODS_INTERNAL) != 0) \
00227 it_write_log_record(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE_METHODS, FuncName);
00228
00229 #define END_METHOD
00230
00231
00232
00233
00234 #define TRACELOG_WITH_LEVEL0(trace_level, description) \
00235 IT_LOG_GUARDED(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , trace_level, description)
00236
00237 #define TRACELOG_WITH_LEVEL(trace_level, description) \
00238 IT_LOG_GUARDED(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , trace_level, description)
00239
00240 #define TRACELOG_WITH_LEVEL1(trace_level, description, Arg1) \
00241 IT_LOG_GUARDED1(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , trace_level, description, Arg1)
00242
00243 #define TRACELOG_WITH_LEVEL2(trace_level, description, Arg1, Arg2) \
00244 IT_LOG_GUARDED2(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , trace_level, description, Arg1, Arg2)
00245
00246 #define TRACELOG_WITH_LEVEL3(trace_level, description, Arg1, Arg2, Arg3) \
00247 IT_LOG_GUARDED3(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , trace_level, description, Arg1, Arg2, Arg3)
00248
00249 #define TRACELOG_WITH_LEVEL4(trace_level, description, Arg1, Arg2, Arg3, Arg4) \
00250 IT_LOG_GUARDED4(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , trace_level, description, Arg1, Arg2, Arg3, Arg4)
00251
00252 #define TRACELOG_WITH_LEVEL5(trace_level, description, Arg1, Arg2, Arg3, Arg4, Arg5) \
00253 IT_LOG_GUARDED5(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , trace_level, description, Arg1, Arg2, Arg3, Arg4, Arg5)
00254
00255
00256
00257 #define TRACELOG_NSN_WITH_LEVEL0(trace_level, description) \
00258 IT_LOG_GUARDED(0, 0, _IT_SUBSYSTEM_SCOPE , trace_level, description)
00259
00260 #define TRACELOG_NSN_WITH_LEVEL(trace_level, description) \
00261 IT_LOG_GUARDED(0, 0, _IT_SUBSYSTEM_SCOPE , trace_level, description)
00262
00263 #define TRACELOG_NSN_WITH_LEVEL1(trace_level, description, Arg1) \
00264 IT_LOG_GUARDED1(0, 0, _IT_SUBSYSTEM_SCOPE , trace_level, description, Arg1)
00265
00266 #define TRACELOG_NSN_WITH_LEVEL2(trace_level, description, Arg1, Arg2) \
00267 IT_LOG_GUARDED2(0, 0, _IT_SUBSYSTEM_SCOPE , trace_level, description, Arg1, Arg2)
00268
00269 #define TRACELOG_NSN_WITH_LEVEL3(trace_level, description, Arg1, Arg2, Arg3) \
00270 IT_LOG_GUARDED3(0, 0, _IT_SUBSYSTEM_SCOPE , trace_level, description, Arg1, Arg2, Arg3)
00271
00272 #define TRACELOG_NSN_WITH_LEVEL4(trace_level, description, Arg1, Arg2, Arg3, Arg4) \
00273 IT_LOG_GUARDED4(0, 0, _IT_SUBSYSTEM_SCOPE , trace_level, description, Arg1, Arg2, Arg3, Arg4)
00274
00275 #define TRACELOG_NSN_WITH_LEVEL5(trace_level, description, Arg1, Arg2, Arg3, Arg4, Arg5) \
00276 IT_LOG_GUARDED5(0, 0, _IT_SUBSYSTEM_SCOPE , trace_level, description, Arg1, Arg2, Arg3, Arg4, Arg5)
00277
00278
00279
00280
00281 #define TRACELOG(description) \
00282 IT_LOG_GUARDED(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE , description)
00283
00284 #define TRACELOG0(description) \
00285 IT_LOG_GUARDED(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE , description)
00286
00287 #define TRACELOG1(description, Arg1) \
00288 IT_LOG_GUARDED1(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE , description, Arg1)
00289
00290 #define TRACELOG2(description, Arg1, Arg2) \
00291 IT_LOG_GUARDED2(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE , description, Arg1, Arg2)
00292
00293 #define TRACELOG3(description, Arg1, Arg2, Arg3) \
00294 IT_LOG_GUARDED3(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE , description, Arg1, Arg2, Arg3)
00295
00296 #define TRACELOG4(description, Arg1, Arg2, Arg3, Arg4) \
00297 IT_LOG_GUARDED4(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE , description, Arg1, Arg2, Arg3, Arg4)
00298
00299 #define TRACELOG5(description, Arg1, Arg2, Arg3, Arg4, Arg5) \
00300 IT_LOG_GUARDED5(0, _IT_SUBSYSTEM_SERVICE, _IT_SUBSYSTEM_SCOPE , IT_TRACE , description, Arg1, Arg2, Arg3, Arg4, Arg5)
00301
00302
00303
00304 #define TRACELOG_NSN(description) \
00305 IT_LOG_GUARDED(0, 0, _IT_SUBSYSTEM_SCOPE , IT_TRACE , description)
00306
00307 #define TRACELOG_NSN0(description) \
00308 IT_LOG_GUARDED(0, 0, _IT_SUBSYSTEM_SCOPE , IT_TRACE , description)
00309
00310 #define TRACELOG_NSN1(description, Arg1) \
00311 IT_LOG_GUARDED1(0, 0, _IT_SUBSYSTEM_SCOPE , IT_TRACE , description, Arg1)
00312
00313 #define TRACELOG_NSN2(description, Arg1, Arg2) \
00314 IT_LOG_GUARDED2(0, 0, _IT_SUBSYSTEM_SCOPE , IT_TRACE , description, Arg1, Arg2)
00315
00316 #define TRACELOG_NSN3(description, Arg1, Arg2, Arg3) \
00317 IT_LOG_GUARDED3(0, 0, _IT_SUBSYSTEM_SCOPE , IT_TRACE , description, Arg1, Arg2, Arg3)
00318
00319 #define TRACELOG_NSN4(description, Arg1, Arg2, Arg3, Arg4) \
00320 IT_LOG_GUARDED4(0, 0, _IT_SUBSYSTEM_SCOPE , IT_TRACE , description, Arg1, Arg2, Arg3, Arg4)
00321
00322 #define TRACELOG_NSN5(description, Arg1, Arg2, Arg3, Arg4, Arg5) \
00323 IT_LOG_GUARDED5(0, 0, _IT_SUBSYSTEM_SCOPE , IT_TRACE , description, Arg1, Arg2, Arg3, Arg4, Arg5)
00324
00325
00326
00327 #ifdef _IT_IN_WSDL_CPP_CLIENT_STUBS
00328 #define _IT_SUBSYSTEM_SCOPE "IT_BUS.STUB.CLIENT"
00329 #endif
00330 #ifdef _IT_IN_WSDL_CPP_SERVER_STUBS
00331 #define _IT_SUBSYSTEM_SCOPE "IT_BUS.STUB.SERVER"
00332 #endif
00333 #ifndef _IT_SUBSYSTEM_SCOPE
00334 #define _IT_SUBSYSTEM_SCOPE "IT_BUS"
00335 #endif
00336
00337 #ifdef _IT_LOGGING_SERVICE_NAME_RETRIEVER_INSTANCE_
00338 #define _IT_SUBSYSTEM_SERVICE _IT_LOGGING_SERVICE_NAME_RETRIEVER_INSTANCE_
00339 #else
00340 #define _IT_SUBSYSTEM_SERVICE 0
00341 #endif
00342
00343 #define IT_INIT_BUS_LOGGER_MEM(bus) _it_bus_logger = 0;
00344 #define IT_NULL_BUS_LOGGER_MEM _it_bus_logger = 0;
00345 #define IT_FINALISE_BUS_LOGGER_MEM(bus) _it_bus_logger = 0;
00346
00347 #endif