-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathlog.h
More file actions
569 lines (501 loc) · 25.1 KB
/
log.h
File metadata and controls
569 lines (501 loc) · 25.1 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#ifndef __LOG_H__
#define __LOG_H__
/*--- INCLUDES ---------------------------------------------------------------*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdarg.h>
#include <time.h>
#include <stdint.h>
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
#include <inttypes.h>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <pthread.h>
#include <common/utils/utils.h>
#include "common/utils/T/T.h"
#if ENABLE_LTTNG
#include "lttng-log.h"
#endif
/*----------------------------------------------------------------------------*/
#include <assert.h>
#ifdef NDEBUG
#warning assert is disabled
#endif
#ifdef __cplusplus
extern "C" {
#endif
/** @}*/
/** @defgroup _log_level Message levels defined by LOG
* @ingroup _macro
* @brief LOG defines 9 levels of messages for users. Importance of these levels decrease gradually from 0 to 8
* @{*/
# define OAILOG_DISABLE -1 /*!< \brief disable all LOG messages, cannot be used in LOG macros, use only in LOG module */
# define OAILOG_ERR 0 /*!< \brief critical error conditions, impact on "must have" functionalities */
# define OAILOG_WARNING 1 /*!< \brief warning conditions, shouldn't happen but doesn't impact "must have" functionalities */
# define OAILOG_ANALYSIS 2 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */
# define OAILOG_INFO 3 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */
# define OAILOG_DEBUG 4 /*!< \brief first level debug-level messages, for developers, may impact real-time behavior */
# define OAILOG_TRACE 5 /*!< \brief second level debug-level messages, for developers, likely impact real-time behavior*/
#define NUM_LOG_LEVEL 6 /*!< \brief the number of message levels users have with LOG (OAILOG_DISABLE is not available to user as a level, so it is not included)*/
/** @}*/
#define SET_LOG_OPTION(O) g_log->flag = (g_log->flag | O)
#define CLEAR_LOG_OPTION(O) g_log->flag = (g_log->flag & (~O))
/** @defgroup macros to identify a debug entity
* @ingroup each macro is a bit mask where the unique bit set identifies an entity to be debugged
* it allows to dynamically activate or not blocks of code. The LOG_MASKMAP_INIT macro
* is used to map a character string name to each debug bit, it allows to set or clear
* the corresponding bit via the defined name, from the configuration or from the telnet
* server.
* @brief
* @{*/
#define FOREACH_FLAG(FLAG_DEF) \
FLAG_DEF(PRACH) \
FLAG_DEF(UE_PHYPROC) \
FLAG_DEF(LTEESTIM) \
FLAG_DEF(DLCELLSPEC) \
FLAG_DEF(ULSCH) \
FLAG_DEF(RRC) \
FLAG_DEF(PDCP) \
FLAG_DEF(DFT) \
FLAG_DEF(ASN1) \
FLAG_DEF(CTRLSOCKET) \
FLAG_DEF(SECURITY) \
FLAG_DEF(NAS) \
FLAG_DEF(DLSCH_DECOD) \
FLAG_DEF(UE_TIMING) \
FLAG_DEF(F1AP)
#define FLAG_BITF(flag) uint64_t DEBUG_##flag: 1;
typedef struct {
FOREACH_FLAG(FLAG_BITF)
} debug_flags_t;
#define FLAG_TEXT(flag) #flag,
static const char *const flag_name[] = {FOREACH_FLAG(FLAG_TEXT) ""};
#define SET_LOG_DEBUG(B) g_log->debug_mask.B = true
#define CLEAR_LOG_DEBUG(B) g_log->debug_mask.B = false
#define SET_LOG_DUMP(B) g_log->dump_mask.B = true
#define CLEAR_LOG_DUMP(B) g_log->dump_mask.B = false
#define FOREACH_COMP(COMP_DEF) \
COMP_DEF(PHY, log) \
COMP_DEF(MAC, log) \
COMP_DEF(EMU, log) \
COMP_DEF(SIM, txt) \
COMP_DEF(OMG, csv) \
COMP_DEF(OPT, log) \
COMP_DEF(OTG, log) \
COMP_DEF(OTG_LATENCY, dat) \
COMP_DEF(OTG_LATENCY_BG, dat) \
COMP_DEF(OTG_GP, dat) \
COMP_DEF(OTG_GP_BG, dat) \
COMP_DEF(OTG_JITTER, dat) \
COMP_DEF(RLC, ) \
COMP_DEF(PDCP, ) \
COMP_DEF(RRC, ) \
COMP_DEF(NAS, log) \
COMP_DEF(OIP, ) \
COMP_DEF(CLI, ) \
COMP_DEF(OCM, ) \
COMP_DEF(GTPU, ) \
COMP_DEF(SDAP, ) \
COMP_DEF(SPGW, ) \
COMP_DEF(S1AP, ) \
COMP_DEF(F1AP, ) \
COMP_DEF(E1AP, ) \
COMP_DEF(SCTP, ) \
COMP_DEF(HW, ) \
COMP_DEF(OSA, ) \
COMP_DEF(ENB_APP, log) \
COMP_DEF(MCE_APP, log) \
COMP_DEF(MME_APP, log) \
COMP_DEF(TMR, ) \
COMP_DEF(USIM, log) \
COMP_DEF(F1U, ) \
COMP_DEF(X2AP, ) \
COMP_DEF(XNAP, ) \
COMP_DEF(M2AP, ) \
COMP_DEF(M3AP, ) \
COMP_DEF(NGAP, ) \
COMP_DEF(NRPPA, ) \
COMP_DEF(GNB_APP, log) \
COMP_DEF(NR_RRC, log) \
COMP_DEF(NR_MAC, log) \
COMP_DEF(NR_MAC_DCI, log) \
COMP_DEF(NR_PHY_DCI, log) \
COMP_DEF(NR_PHY_RACH, log) \
COMP_DEF(NR_PHY, log) \
COMP_DEF(LOADER, log) \
COMP_DEF(ASN1, log) \
COMP_DEF(NFAPI_VNF, log) \
COMP_DEF(NFAPI_PNF, log) \
COMP_DEF(ITTI, log) \
COMP_DEF(UTIL, log) \
COMP_DEF(MAX_LOG_PREDEF_COMPONENTS, )
#define COMP_ENUM(comp, file_extension) comp,
typedef enum { FOREACH_COMP(COMP_ENUM) } comp_name_t;
#define COMP_TEXT(comp, file_extension) #comp,
static const char *const comp_name[] = {FOREACH_COMP(COMP_TEXT)};
#define COMP_EXTENSION(comp, file_extension) #file_extension,
static const char *const comp_extension[] = {FOREACH_COMP(COMP_EXTENSION)};
#define MAX_LOG_DYNALLOC_COMPONENTS 20
#define MAX_LOG_COMPONENTS (MAX_LOG_PREDEF_COMPONENTS + MAX_LOG_DYNALLOC_COMPONENTS)
typedef struct {
char *name; /*!< \brief string name of item */
int value; /*!< \brief integer value of mapping */
} mapping;
typedef int(*log_vprint_func_t)(FILE *stream, const char *format, va_list ap );
typedef int(*log_print_func_t)(FILE *stream, const char *format, ... );
typedef struct {
int savedlevel;
char *filelog_name;
} log_component_back_t;
typedef struct {
const char *name;
char headerName[19];
int level;
int filelog;
FILE *stream;
log_vprint_func_t vprint;
log_print_func_t print;
} log_component_t;
typedef struct {
log_component_t log_component[MAX_LOG_COMPONENTS];
log_component_back_t log_rarely_used[MAX_LOG_COMPONENTS];
char level2string[NUM_LOG_LEVEL][4];
int flag;
char *filelog_name;
debug_flags_t debug_mask;
debug_flags_t dump_mask;
} log_t;
#ifdef LOG_MAIN
log_t *g_log;
#else
#ifdef __cplusplus
extern "C" {
#endif
extern log_t *g_log;
#ifdef __cplusplus
}
#endif
#endif
#define FLAG_DEBUG_SET(flag) \
if (strcmp(name, #flag) == 0) { \
g_log->debug_mask.DEBUG_##flag = val; \
return true; \
};
static inline bool set_log_debug(char *name, bool val)
{
FOREACH_FLAG(FLAG_DEBUG_SET);
printf("Error: setting log debug of %s option, not existing\n", name);
return false;
}
#define FLAG_DUMP_SET(flag) \
if (strcmp(name, #flag) == 0) { \
g_log->dump_mask.DEBUG_##flag = val; \
return true; \
};
static inline bool set_log_dump(char *name, bool val)
{
FOREACH_FLAG(FLAG_DUMP_SET);
printf("Error: setting log dump of %s option, not existing\n", name);
return false;
}
/*----------------------------------------------------------------------------*/
int logInit (void);
void logTerm (void);
int isLogInitDone (void);
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
void vlogRecord_mt(const char *file, const char *func, int line, int comp, int level, const char *format, va_list args );
#if ENABLE_LTTNG
void logRecord_lttng(const char *file, const char *func, int line, int comp, int level, const char *format, ...)
__attribute__((format(printf, 6, 7)));
#endif
void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... );
int set_log(int component, int level);
void set_glog(int level);
mapping * log_level_names_ptr(void);
mapping * log_option_names_ptr(void);
mapping * log_maskmap_ptr(void);
void set_glog_onlinelog(int enable);
void set_glog_filelog(int enable);
void set_component_filelog(int comp);
void close_component_filelog(int comp);
void set_component_consolelog(int comp);
int map_str_to_int(const mapping *map, const char *str);
char *map_int_to_str(const mapping *map, const int val);
void logClean (void);
int register_log_component(const char *name, const char *fext, int compidx);
int logInit_log_mem(char*);
void close_log_mem(void);
/** @}*/
/*!\fn int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, char format);
\brief Write output file from signal data
@param fname output file name
@param vname output vector name (for MATLAB/OCTAVE)
@param data point to data
@param length length of data vector to output
@param dec decimation level
@param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit)
@param multiVec create new file or append to existing (useful for writing multiple vectors to same file. Just call the function multiple times with same file name and with this parameter set to 1)
*/
#define MATLAB_RAW (1U<<31)
int32_t write_file_matlab(const char *fname,
const char *vname,
const void *data,
int length,
int dec,
unsigned int format,
int multiVec);
#define write_output(a, b, c, d, e, f) write_file_matlab(a, b, c, d, e, f, 0)
/*----------------macro definitions for reading log configuration from the config module */
#define CONFIG_STRING_LOG_PREFIX "log_config"
#define LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL "global_log_level"
#define LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE "global_log_online"
#define LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS "global_log_options"
#define LOG_CONFIG_LEVEL_FORMAT "%s_log_level"
#define LOG_CONFIG_LOGFILE_FORMAT "%s_log_infile"
#define LOG_CONFIG_DEBUG_FORMAT "%s_debug"
#define LOG_CONFIG_DUMP_FORMAT "%s_dump"
#define LOG_CONFIG_HELP_OPTIONS " list of comma separated options to enable log module behavior. Available options: \n"\
" nocolor: disable color usage in log messages\n"\
" level: add log level indication in log messages\n"\
" thread: add threads names in log messages\n"
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* LOG global configuration parameters */
/* optname help paramflags XXXptr defXXXval type numelt */
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
// clang-format off
#define LOG_GLOBALPARAMS_DESC { \
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, .strptr=&gloglevel, .defstrval=log_level_names[3].name, TYPE_STRING, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, .iptr=&(consolelog), .defintval=1, TYPE_INT, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0, .strlistptr=NULL, .defstrlistval=NULL, TYPE_STRINGLIST, 0}, \
}
// clang-format on
#define LOG_OPTIONS_IDX 2
/*----------------------------------------------------------------------------------*/
/** @defgroup _debugging debugging macros
* @ingroup _macro
* @brief Macro used to call logIt function with different message levels
* @{*/
#define LOG_DUMP_CHAR 0
#define LOG_DUMP_DOUBLE 1
#define LOG_DUMP_I16 2
#define LOG_DUMP_C16 3
#define LOG_DUMP_C32 4
// debugging macros
#define LOG_F LOG_I /* because LOG_F was originaly to dump a message or buffer but is also used as a regular level...., to dump use LOG_DUMPMSG */
# if T_TRACER
#include "T.h"
/* per component, level dependent macros */
#define LOG_E(c, x...) \
do { \
T(T_LEGACY_##c##_ERROR, T_PRINTF(x)); \
if (T_stdout) { \
if (g_log->log_component[c].level >= OAILOG_ERR) \
logRecord_mt(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_ERR, x); \
} \
} while (0)
#define LOG_W(c, x...) \
do { \
T(T_LEGACY_##c##_WARNING, T_PRINTF(x)); \
if (T_stdout) { \
if (g_log->log_component[c].level >= OAILOG_WARNING) \
logRecord_mt(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_WARNING, x); \
} \
} while (0)
#define LOG_A(c, x...) \
do { \
T(T_LEGACY_##c##_INFO, T_PRINTF(x)); \
if (T_stdout) { \
if (g_log->log_component[c].level >= OAILOG_ANALYSIS) \
logRecord_mt(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_ANALYSIS, x); \
} \
} while (0)
#define LOG_I(c, x...) \
do { \
T(T_LEGACY_##c##_INFO, T_PRINTF(x)); \
if (T_stdout) { \
if (g_log->log_component[c].level >= OAILOG_INFO) \
logRecord_mt(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_INFO, x); \
} \
} while (0)
#define LOG_D(c, x...) \
do { \
T(T_LEGACY_##c##_DEBUG, T_PRINTF(x)); \
if (T_stdout) { \
if (g_log->log_component[c].level >= OAILOG_DEBUG) \
logRecord_mt(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_DEBUG, x); \
} \
} while (0)
#define LOG_DDUMP(c, b, s, f, x...) \
do { \
T(T_LEGACY_##c##_DEBUG, T_PRINTF(x)); \
if (T_stdout) { \
if (g_log->log_component[c].level >= OAILOG_DEBUG) \
log_dump(c, b, s, f, x); \
} \
} while (0)
#define LOG_T(c, x...) \
do { \
T(T_LEGACY_##c##_TRACE, T_PRINTF(x)); \
if (T_stdout) { \
if (g_log->log_component[c].level >= OAILOG_TRACE) \
logRecord_mt(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_TRACE, x); \
} \
} while (0)
#define VLOG(c, l, f, args) \
do { \
if (T_stdout) { \
if (g_log->log_component[c].level >= l) \
vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__, c, l, f, args); \
} \
} while (0)
/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */
#define LOG_DUMPMSG(c, f, b, s, x...) \
do { \
if (g_log->dump_mask.f) \
log_dump(c, b, s, LOG_DUMP_CHAR, x); \
} while (0)
/* bitmask dependent macros, to isolate debugging code */
#define LOG_DEBUGFLAG(D) (g_log->debug_mask.D)
/* bitmask dependent macros, to generate debug file such as matlab file or message dump */
#define LOG_DUMPFLAG(D) (g_log->dump_mask.D)
#define LOG_M(file, vector, data, len, dec, format) \
do { \
write_file_matlab(file, vector, data, len, dec, format, 0); \
} while (0)
/* define variable only used in LOG macro's */
#define LOG_VAR(A, B) A B
#else /* T_TRACER */
#if ENABLE_LTTNG
#define LOG_E(c, x...) \
do { \
if (g_log->log_component[c].level >= OAILOG_ERR) { \
logRecord_lttng(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_ERR, x); \
} \
} while (0)
#define LOG_W(c, x...) \
do { \
if (g_log->log_component[c].level >= OAILOG_WARNING) { \
logRecord_lttng(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_WARNING, x); \
} \
} while (0)
#define LOG_A(c, x...) \
do { \
if (g_log->log_component[c].level >= OAILOG_ANALYSIS) { \
logRecord_lttng(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_ANALYSIS, x); \
} \
} while (0)
#define LOG_I(c, x...) \
do { \
if (g_log->log_component[c].level >= OAILOG_INFO) { \
logRecord_lttng(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_INFO, x); \
} \
} while (0)
#define LOG_D(c, x...) \
do { \
if (g_log->log_component[c].level >= OAILOG_DEBUG) { \
logRecord_lttng(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_DEBUG, x); \
} \
} while (0)
#define LOG_T(c, x...) \
do { \
if (g_log->log_component[c].level >= OAILOG_TRACE) { \
logRecord_lttng(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_TRACE, x); \
} \
} while (0)
#define LOG_DDUMP(c, b, s, f, x...) \
do { \
if (g_log->log_component[c].level >= OAILOG_DEBUG) \
log_dump(c, b, s, f, x); \
} while (0)
#else
#define LOG_E(c, x...) \
do { \
if (g_log->log_component[c].level >= OAILOG_ERR) \
logRecord_mt(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_ERR, x); \
} while (0)
#define LOG_W(c, x...) \
do { \
if (g_log->log_component[c].level >= OAILOG_WARNING) \
logRecord_mt(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_WARNING, x); \
} while (0)
#define LOG_A(c, x...) \
do { \
if (g_log->log_component[c].level >= OAILOG_ANALYSIS) \
logRecord_mt(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_ANALYSIS, x); \
} while (0)
#define LOG_I(c, x...) \
do { \
if (g_log->log_component[c].level >= OAILOG_INFO) \
logRecord_mt(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_INFO, x); \
} while (0)
#define LOG_D(c, x...) \
do { \
if (g_log->log_component[c].level >= OAILOG_DEBUG) \
logRecord_mt(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_DEBUG, x); \
} while (0)
#define LOG_DDUMP(c, b, s, f, x...) \
do { \
if (g_log->log_component[c].level >= OAILOG_DEBUG) \
log_dump(c, b, s, f, x); \
} while (0)
#define LOG_T(c, x...) \
do { \
if (g_log->log_component[c].level >= OAILOG_TRACE) \
logRecord_mt(__FILE__, __FUNCTION__, __LINE__, c, OAILOG_TRACE, x); \
} while (0)
#endif
#define VLOG(c, l, f, args) \
do { \
if (g_log->log_component[c].level >= l) \
vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__, c, l, f, args); \
} while (0)
#define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...)
#define LOG_DEBUGFLAG(D) (g_log->debug_mask.D)
#define LOG_DUMPFLAG(D) (g_log->dump_mask.D)
#define LOG_DUMPMSG(c, f, b, s, x...) \
do { \
if (g_log->dump_mask.f) \
log_dump(c, b, s, LOG_DUMP_CHAR, x); \
} while (0) /* */
#define LOG_M(file, vector, data, len, dec, format) \
do { \
write_file_matlab(file, vector, data, len, dec, format, 0); \
} while (0)
#define LOG_VAR(A, B) A B
#define T_ACTIVE(a) (0)
#endif /* T_TRACER */
/* avoid warnings for variables only used in LOG macro's but set outside debug section */
#define GCC_NOTUSED __attribute__((unused))
#define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B
/* unfiltered macros, useful for simulators or messages at init time, before log is configured */
#define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)
#define LOG_UI(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0)
#define LOG_UDUMPMSG(c, b, s, f, x...) do { log_dump(c, b, s, f, x) ;} while (0) /* */
# define LOG_MM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 1);} while(0)
/** @}*/
/** @defgroup _useful_functions useful functions in LOG
* @ingroup _macro
* @brief Macro of some useful functions defined by LOG
* @{*/
#define LOG_ENTER(c) do {LOG_T(c, "Entering %s\n",__FUNCTION__);}while(0) /*!< \brief Macro to log a message with severity DEBUG when entering a function */
#define LOG_END(c) do {LOG_T(c, "End of %s\n",__FUNCTION__);}while(0) /*!< \brief Macro to log a message with severity DEBUG when entering a function */
#define LOG_EXIT(c) do { LOG_END(c); return;}while(0) /*!< \brief Macro to log a message with severity TRACE when exiting a function */
#define LOG_RETURN(c,r) do {LOG_T(c,"Leaving %s (rc = %08lx)\n", __FUNCTION__ , (unsigned long)(r) );return(r);}while(0) /*!< \brief Macro to log a function exit, including integer value, then to return a value to the calling function */
/** @}*/
#ifdef __cplusplus
}
#endif
#endif