Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
s/_XBT_GNUC_FUNCTION/_XBT_FUNCTION/ (that's how to get __FUNCTION__ portably)
[simgrid.git] / include / xbt / log.h
1 /* $Id$ */
2
3 /* log - a generic logging facility in the spirit of log4j                  */
4
5 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved.            */
6
7 /* This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. */
9
10 /* XBT_LOG_MAYDAY: define this to replace the logging facilities with basic
11    printf function. Useful to debug the logging facilities themselves */
12 #undef XBT_LOG_MAYDAY
13 /*#define XBT_LOG_MAYDAY*/
14
15 #ifndef _XBT_LOG_H_
16 #define _XBT_LOG_H_
17
18 #include "xbt/misc.h"
19
20 #include <stdarg.h>
21
22 /**\brief Log priorities
23  * \ingroup XBT_log
24  *
25  * The different existing priorities.
26 */
27 typedef enum {
28   xbt_log_priority_none          = 0,  /* used internally (don't poke with) */
29   xbt_log_priority_trace         = 1,  /**< enter and return of some functions */
30   xbt_log_priority_debug         = 2,  /**< crufty output  */
31   xbt_log_priority_verbose       = 3,  /**< verbose output for the user wanting more */
32   xbt_log_priority_info          = 4,  /**< output about the regular functionning */
33   xbt_log_priority_warning       = 5,  /**< minor issue encountered */
34   xbt_log_priority_error         = 6,  /**< issue encountered */
35   xbt_log_priority_critical      = 7,  /**< major issue encountered */
36
37   xbt_log_priority_infinite      = 8,  /**< value for XBT_LOG_STATIC_THRESHOLD to not log */
38
39   xbt_log_priority_uninitialized = -1  /* used internally (don't poke with) */
40 } e_xbt_log_priority_t;
41               
42
43 /*
44  * define NLOG to disable at compilation time any logging request
45  * define NDEBUG to disable at compilation time any logging request of priority below INFO
46  */
47
48
49 /**
50  * @def XBT_LOG_STATIC_THRESHOLD
51  * @ingroup XBT_log
52  *
53  * All logging requests with priority < XBT_LOG_STATIC_THRESHOLD are disabled at
54  * compile time, i.e., compiled out.
55  */
56 #ifdef NLOG
57 #  define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_infinite
58 #else
59
60 #  ifdef NDEBUG
61 #    define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_verbose
62 #  else /* !NLOG && !NDEBUG */
63
64 #    ifndef XBT_LOG_STATIC_THRESHOLD
65 #      define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_none
66 #    endif /* !XBT_LOG_STATIC_THRESHOLD */
67 #  endif /* NDEBUG */
68 #endif /* !defined(NLOG) */
69
70 /* Transforms a category name to a global variable name. */
71 #define _XBT_LOGV(cat)   _XBT_LOG_CONCAT(_gras_this_log_category_does_not_exist__, cat)
72 #define _XBT_LOG_CONCAT(x,y) x ## y
73
74 /* The root of the category hierarchy. */
75 #define XBT_LOG_ROOT_CAT   root
76
77 /* XBT_LOG_NEW_SUBCATEGORY_helper:
78  * Implementation of XBT_LOG_NEW_SUBCATEGORY, which must declare "extern parent" in addition
79  * to avoid an extra declaration of root when XBT_LOG_NEW_SUBCATEGORY is called by
80  * XBT_LOG_NEW_CATEGORY */
81 #define XBT_LOG_NEW_SUBCATEGORY_helper(catName, parent, desc) \
82     s_xbt_log_category_t _XBT_LOGV(catName) = {       \
83         &_XBT_LOGV(parent), 0, 0,                    \
84         #catName, xbt_log_priority_uninitialized, 1, \
85         0, 1                                          \
86     }
87 /**
88  * \ingroup XBT_log
89  * \param catName name of new category
90  * \param parent father of the new category in the tree
91  * \param desc string describing the purpose of this category
92  *
93  * Defines a new subcategory of the parent. 
94  */
95 #define XBT_LOG_NEW_SUBCATEGORY(catName, parent, desc)    \
96     extern s_xbt_log_category_t _XBT_LOGV(parent);        \
97     XBT_LOG_NEW_SUBCATEGORY_helper(catName, parent, desc) \
98
99 /**
100  * \ingroup XBT_log  
101  * \param catName name of new category
102  * \param desc string describing the purpose of this category
103  *
104  * Creates a new subcategory of the root category.
105  */
106 #define XBT_LOG_NEW_CATEGORY(catName,desc)  XBT_LOG_NEW_SUBCATEGORY_helper(catName, XBT_LOG_ROOT_CAT, desc)
107
108 /**
109  * \ingroup XBT_log  
110  * \param cname name of the cat
111  *
112  * Indicates which category is the default one.
113  */
114
115 #if defined(XBT_LOG_MAYDAY) /*|| defined (NLOG) * turning logging off */
116 # define XBT_LOG_DEFAULT_CATEGORY(cname)
117 #else
118 # define XBT_LOG_DEFAULT_CATEGORY(cname) \
119          static xbt_log_category_t _XBT_LOGV(default) = &_XBT_LOGV(cname)
120 #endif
121
122 /**
123  * \ingroup XBT_log  
124  * \param cname name of the cat
125  * \param desc string describing the purpose of this category
126  *
127  * Creates a new subcategory of the root category and makes it the default
128  * (used by macros that don't explicitly specify a category).
129  */
130 #define XBT_LOG_NEW_DEFAULT_CATEGORY(cname,desc)        \
131     XBT_LOG_NEW_CATEGORY(cname,desc);                   \
132     XBT_LOG_DEFAULT_CATEGORY(cname)
133
134 /**
135  * \ingroup XBT_log  
136  * \param cname name of the cat
137  * \param parent name of the parent
138  * \param desc string describing the purpose of this category
139  *
140  * Creates a new subcategory of the parent category and makes it the default
141  * (used by macros that don't explicitly specify a category).
142  */
143 #define XBT_LOG_NEW_DEFAULT_SUBCATEGORY(cname, parent, desc) \
144     XBT_LOG_NEW_SUBCATEGORY(cname, parent, desc);            \
145     XBT_LOG_DEFAULT_CATEGORY(cname)
146
147 /**
148  * \ingroup XBT_log  
149  * \param cname name of the cat
150  *
151  * Indicates that a category you'll use in this file (to get subcategories of it, 
152  * for example) really lives in another file.
153  */
154
155 #define XBT_LOG_EXTERNAL_CATEGORY(cname) \
156    extern s_xbt_log_category_t _XBT_LOGV(cname)
157
158 /* Functions you may call */
159
160 extern void xbt_log_control_set(const char* cs);
161
162 /* Forward declarations */
163 typedef struct xbt_log_appender_s s_xbt_log_appender_t,*xbt_log_appender_t;
164 typedef struct xbt_log_event_s    s_xbt_log_event_t,   *xbt_log_event_t;
165 typedef struct xbt_log_category_s s_xbt_log_category_t,*xbt_log_category_t;
166
167 /*
168  * Do NOT access any members of this structure directly. FIXME: move to private?
169  */
170 struct xbt_log_category_s {
171             xbt_log_category_t parent;
172 /*@null@*/  xbt_log_category_t firstChild; 
173 /*@null@*/  xbt_log_category_t nextSibling;
174             const char *name;
175             int threshold;
176             int isThreshInherited;
177 /*@null@*/  xbt_log_appender_t appender;
178             int willLogToParent;
179   /* TODO: Formats? */
180 };
181
182 struct xbt_log_appender_s {
183   void (*do_append) (xbt_log_appender_t thisLogAppender,
184                     xbt_log_event_t event, const char *fmt);
185   void *appender_data;
186 };
187
188 struct xbt_log_event_s {
189   xbt_log_category_t cat;
190   e_xbt_log_priority_t priority;
191   const char* fileName;
192   const char* functionName;
193   int lineNum;
194   va_list ap;
195 };
196
197 /**
198  * \ingroup XBT_log_implem
199  * \param cat the category (not only its name, but the variable)
200  * \param thresholdPriority the priority
201  *
202  * Programatically alters a category's threshold priority (don't use).
203  */
204 extern void xbt_log_threshold_set(xbt_log_category_t cat,
205                                    e_xbt_log_priority_t thresholdPriority);
206
207 /**
208  * \ingroup XBT_log_implem  
209  * \param cat the category (not only its name, but the variable)
210  * \param parent the parent cat
211  *
212  * Programatically alter a category's parent (don't use).
213  */
214 extern void xbt_log_parent_set(xbt_log_category_t cat,
215                                 xbt_log_category_t parent);
216
217 /**
218  * \ingroup XBT_log_implem  
219  * \param cat the category (not only its name, but the variable)
220  * \param app the appender
221  *
222  * Programatically sets the category's appender (don't use).
223  */
224 extern void xbt_log_appender_set(xbt_log_category_t cat,
225                                   xbt_log_appender_t app);
226
227 /* Functions that you shouldn't call. */
228 extern void _xbt_log_event_log(xbt_log_event_t ev,
229                                 const char *fmt,
230                                 ...) _XBT_GNUC_PRINTF(2,3);
231
232 extern int _xbt_log_cat_init(e_xbt_log_priority_t priority, 
233                               xbt_log_category_t   category);
234
235
236 extern s_xbt_log_category_t _XBT_LOGV(XBT_LOG_ROOT_CAT);
237 XBT_LOG_EXTERNAL_CATEGORY(GRAS);
238 extern xbt_log_appender_t xbt_log_default_appender;
239
240 /**
241  * \ingroup XBT_log 
242  * \param catName name of the category
243  * \param priority minimal priority to be enabled to return true
244  *
245  * Returns true if the given priority is enabled for the category.
246  * If you have expensive expressions that are computed outside of the log
247  * command and used only within it, you should make its evaluation conditional
248  * using this macro.
249  */
250 #define XBT_LOG_ISENABLED(catName, priority) \
251             _XBT_LOG_ISENABLEDV(_XBT_LOGV(catName), priority)
252
253 /*
254  * Helper function that implements XBT_LOG_ISENABLED.
255  *
256  * NOTES
257  * First part is a compile-time constant.
258  * Call to _log_initCat only happens once.
259  */
260 #define _XBT_LOG_ISENABLEDV(catv, priority)                  \
261        (priority >= XBT_LOG_STATIC_THRESHOLD                 \
262         && priority >= catv.threshold                         \
263         && (catv.threshold != xbt_log_priority_uninitialized \
264             || _xbt_log_cat_init(priority, &catv)) )
265
266 /*
267  * Internal Macros
268  * Some kludge macros to ease maintenance. See how they're used below.
269  *
270  * IMPLEMENTATION NOTE: To reduce the parameter passing overhead of an enabled
271  * message, the many parameters passed to the logging function are packed in a
272  * structure. Since these values will be usually be passed to at least 3
273  * functions, this is a win.
274  * It also allows adding new values (such as a timestamp) without breaking
275  * code. 
276  * Setting the LogEvent's valist member is done inside _log_logEvent.
277  */
278
279 #define _XBT_LOG_PRE(catv, priority) do {                              \
280      if (_XBT_LOG_ISENABLEDV(catv, priority)) {                        \
281          s_xbt_log_event_t _log_ev =                                   \
282              {&(catv),priority,__FILE__,_XBT_FUNCTION,__LINE__};         \
283          _xbt_log_event_log(&_log_ev
284
285 #define _XBT_LOG_POST                          \
286                         );                      \
287      } } while(0)
288
289
290 /* Logging Macros */
291
292 #ifdef XBT_LOG_MAYDAY
293 # define CLOG0(c, p, f)                   fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
294 # define CLOG1(c, p, f,a1)                fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)               
295 # define CLOG2(c, p, f,a1,a2)             fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)            
296 # define CLOG3(c, p, f,a1,a2,a3)          fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)         
297 # define CLOG4(c, p, f,a1,a2,a3,a4)       fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)      
298 # define CLOG5(c, p, f,a1,a2,a3,a4,a5)    fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)   
299 # define CLOG6(c, p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6)
300 # define CLOG7(c, p, f,a1,a2,a3,a4,a5,a6,a7) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7)
301 # define CLOG8(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8)
302 #else
303 # define CLOG0(c, p, f)                   _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f _XBT_LOG_POST            
304 # define CLOG1(c, p, f,a1)                _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1 _XBT_LOG_POST                 
305 # define CLOG2(c, p, f,a1,a2)             _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2 _XBT_LOG_POST
306 # define CLOG3(c, p, f,a1,a2,a3)          _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3 _XBT_LOG_POST
307 # define CLOG4(c, p, f,a1,a2,a3,a4)       _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
308 # define CLOG5(c, p, f,a1,a2,a3,a4,a5)    _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5 _XBT_LOG_POST
309 # define CLOG6(c, p, f,a1,a2,a3,a4,a5,a6) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6 _XBT_LOG_POST
310 # define CLOG7(c, p, f,a1,a2,a3,a4,a5,a6,a7) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6,a7 _XBT_LOG_POST
311 # define CLOG8(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8 _XBT_LOG_POST
312 #endif
313
314 #define CDEBUG0(c, f)                   CLOG0(c, xbt_log_priority_debug, f)
315 #define CDEBUG1(c, f,a1)                CLOG1(c, xbt_log_priority_debug, f,a1)
316 #define CDEBUG2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_debug, f,a1,a2)
317 #define CDEBUG3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_debug, f,a1,a2,a3)
318 #define CDEBUG4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_debug, f,a1,a2,a3,a4)
319 #define CDEBUG5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
320 #define CDEBUG6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
321 #define CDEBUG7(c, f,a1,a2,a3,a4,a5,a6,a7) CLOG7(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
322 #define CDEBUG8(c, f,a1,a2,a3,a4,a5,a6,a7,a8) CLOG8(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8)
323
324 #define CVERB0(c, f)                   CLOG0(c, xbt_log_priority_verbose, f)
325 #define CVERB1(c, f,a1)                CLOG1(c, xbt_log_priority_verbose, f,a1)
326 #define CVERB2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_verbose, f,a1,a2)
327 #define CVERB3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_verbose, f,a1,a2,a3)
328 #define CVERB4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_verbose, f,a1,a2,a3,a4)
329 #define CVERB5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
330 #define CVERB6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
331
332 #define CINFO0(c, f)                   CLOG0(c, xbt_log_priority_info, f)
333 #define CINFO1(c, f,a1)                CLOG1(c, xbt_log_priority_info, f,a1)
334 #define CINFO2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_info, f,a1,a2)
335 #define CINFO3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_info, f,a1,a2,a3)
336 #define CINFO4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_info, f,a1,a2,a3,a4)
337 #define CINFO5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5)
338 #define CINFO6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
339
340 #define CWARN0(c, f)                   CLOG0(c, xbt_log_priority_warning, f)
341 #define CWARN1(c, f,a1)                CLOG1(c, xbt_log_priority_warning, f,a1)
342 #define CWARN2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_warning, f,a1,a2)
343 #define CWARN3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_warning, f,a1,a2,a3)
344 #define CWARN4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_warning, f,a1,a2,a3,a4)
345 #define CWARN5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
346 #define CWARN6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
347
348 #define CERROR0(c, f)                   CLOG0(c, xbt_log_priority_error, f)
349 #define CERROR1(c, f,a1)                CLOG1(c, xbt_log_priority_error, f,a1)
350 #define CERROR2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_error, f,a1,a2)
351 #define CERROR3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_error, f,a1,a2,a3)
352 #define CERROR4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_error, f,a1,a2,a3,a4)
353 #define CERROR5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5)
354 #define CERROR6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
355
356 #define CCRITICAL0(c, f)                   CLOG0(c, xbt_log_priority_critical, f)
357 #define CCRITICAL1(c, f,a1)                CLOG1(c, xbt_log_priority_critical, f,a1)
358 #define CCRITICAL2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_critical, f,a1,a2)
359 #define CCRITICAL3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_critical, f,a1,a2,a3)
360 #define CCRITICAL4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_critical, f,a1,a2,a3,a4)
361 #define CCRITICAL5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
362 #define CCRITICAL6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
363
364 #ifdef XBT_LOG_MAYDAY
365 # define LOG0(p, f)                   fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
366 # define LOG1(p, f,a1)                fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)               
367 # define LOG2(p, f,a1,a2)             fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)            
368 # define LOG3(p, f,a1,a2,a3)          fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)         
369 # define LOG4(p, f,a1,a2,a3,a4)       fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)      
370 # define LOG5(p, f,a1,a2,a3,a4,a5)    fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)   
371 # define LOG6(p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6)
372 # define LOG7(p, f,a1,a2,a3,a4,a5,a6,a7) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7)
373 # define LOG8(p, f,a1,a2,a3,a4,a5,a6,a7,a8) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8)
374 #else
375 # define LOG0(p, f)                   _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f _XBT_LOG_POST
376 # define LOG1(p, f,a1)                _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1 _XBT_LOG_POST
377 # define LOG2(p, f,a1,a2)             _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2 _XBT_LOG_POST
378 # define LOG3(p, f,a1,a2,a3)          _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3 _XBT_LOG_POST
379 # define LOG4(p, f,a1,a2,a3,a4)       _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
380 # define LOG5(p, f,a1,a2,a3,a4,a5)    _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5 _XBT_LOG_POST
381 # define LOG6(p, f,a1,a2,a3,a4,a5,a6) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6 _XBT_LOG_POST
382 # define LOG7(p, f,a1,a2,a3,a4,a5,a6,a7) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6,a7 _XBT_LOG_POST
383 # define LOG8(p, f,a1,a2,a3,a4,a5,a6,a7,a8) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8 _XBT_LOG_POST
384 #endif
385
386 /** \name DEBUG
387  * \ingroup XBT_log
388  * Log something to the current default category under the debug priority.
389  * \param f the format string
390  * \param a1 first argument of the format
391  * \param a2 second argument of the format
392  * \param a3 third argument of the format
393  * \param a4 fourth argument of the format
394  * \param a5 fifth argument of the format
395  * \param a6 sixth argument of the format
396  *
397  * The macros DEBUG0 ... DEBUG5 naturally also exist, but are not listed here 
398  * for sake of clarity. They just differ in the number of arguments passed
399  * along with the format string.
400  */
401 /* @{ */
402 #define DEBUG0(f)                   LOG0(xbt_log_priority_debug, f)
403 #define DEBUG1(f,a1)                LOG1(xbt_log_priority_debug, f,a1)
404 #define DEBUG2(f,a1,a2)             LOG2(xbt_log_priority_debug, f,a1,a2)
405 #define DEBUG3(f,a1,a2,a3)          LOG3(xbt_log_priority_debug, f,a1,a2,a3)
406 #define DEBUG4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_debug, f,a1,a2,a3,a4)
407 #define DEBUG5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
408 #define DEBUG6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
409 #define DEBUG7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
410 #define DEBUG8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8)
411 /* @} */
412
413 /** \name VERB
414  * \ingroup XBT_log
415  * Log something to the current default category under the verbose priority.
416  * \param f the format string
417  * \param a1 first argument of the format
418  * \param a2 second argument of the format
419  * \param a3 third argument of the format
420  * \param a4 fourth argument of the format
421  * \param a5 fifth argument of the format
422  * \param a6 sixth argument of the format
423  *
424  * The macros VERB0 ... VERB5 naturally also exist, but are not listed here 
425  * for sake of clarity. They just differ in the number of arguments passed
426  * along with the format string.
427  */
428 /* @{ */
429 #define VERB0(f)                   LOG0(xbt_log_priority_verbose, f)
430 #define VERB1(f,a1)                LOG1(xbt_log_priority_verbose, f,a1)
431 #define VERB2(f,a1,a2)             LOG2(xbt_log_priority_verbose, f,a1,a2)
432 #define VERB3(f,a1,a2,a3)          LOG3(xbt_log_priority_verbose, f,a1,a2,a3)
433 #define VERB4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_verbose, f,a1,a2,a3,a4)
434 #define VERB5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
435 #define VERB6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
436 /* @} */
437
438 /** \name INFO
439  * \ingroup XBT_log
440  * Log something to the current default category under the info priority.
441  * \param f the format string
442  * \param a1 first argument of the format
443  * \param a2 second argument of the format
444  * \param a3 third argument of the format
445  * \param a4 fourth argument of the format
446  * \param a5 fifth argument of the format
447  * \param a6 sixth argument of the format
448  *
449  * The macros INFO0 ... INFO5 naturally also exist, but are not listed here 
450  * for sake of clarity. They just differ in the number of arguments passed
451  * along with the format string.
452  */
453 /* @{ */
454 #define INFO0(f)                   LOG0(xbt_log_priority_info, f)
455 #define INFO1(f,a1)                LOG1(xbt_log_priority_info, f,a1)
456 #define INFO2(f,a1,a2)             LOG2(xbt_log_priority_info, f,a1,a2)
457 #define INFO3(f,a1,a2,a3)          LOG3(xbt_log_priority_info, f,a1,a2,a3)
458 #define INFO4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_info, f,a1,a2,a3,a4)
459 #define INFO5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_info, f,a1,a2,a3,a4,a5)
460 #define INFO6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
461 /* @} */
462
463 /** \name WARN
464  * \ingroup XBT_log
465  * Log something to the current default category under the warning priority.
466  * \param f the format string
467  * \param a1 first argument of the format
468  * \param a2 second argument of the format
469  * \param a3 third argument of the format
470  * \param a4 fourth argument of the format
471  * \param a5 fifth argument of the format
472  * \param a6 sixth argument of the format
473  *
474  * The macros WARN0 ... WARN5 naturally also exist, but are not listed here 
475  * for sake of clarity. They just differ in the number of arguments passed
476  * along with the format string.
477  */
478 /* @{ */
479 #define WARN0(f)                   LOG0(xbt_log_priority_warning, f)
480 #define WARN1(f,a1)                LOG1(xbt_log_priority_warning, f,a1)
481 #define WARN2(f,a1,a2)             LOG2(xbt_log_priority_warning, f,a1,a2)
482 #define WARN3(f,a1,a2,a3)          LOG3(xbt_log_priority_warning, f,a1,a2,a3)
483 #define WARN4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_warning, f,a1,a2,a3,a4)
484 #define WARN5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
485 #define WARN6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
486 /* @} */
487
488 /** \name ERROR
489  * \ingroup XBT_log
490  * Log something to the current default category under the error priority.
491  * \param f the format string
492  * \param a1 first argument of the format
493  * \param a2 second argument of the format
494  * \param a3 third argument of the format
495  * \param a4 fourth argument of the format
496  * \param a5 fifth argument of the format
497  * \param a6 sixth argument of the format
498  *
499  * The macros ERROR0 ... ERROR5 naturally also exist, but are not listed here 
500  * for sake of clarity. They just differ in the number of arguments passed
501  * along with the format string.
502  */
503 /* @{ */
504 #define ERROR0(f)                   LOG0(xbt_log_priority_error, f)
505 #define ERROR1(f,a1)                LOG1(xbt_log_priority_error, f,a1)
506 #define ERROR2(f,a1,a2)             LOG2(xbt_log_priority_error, f,a1,a2)
507 #define ERROR3(f,a1,a2,a3)          LOG3(xbt_log_priority_error, f,a1,a2,a3)
508 #define ERROR4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_error, f,a1,a2,a3,a4)
509 #define ERROR5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_error, f,a1,a2,a3,a4,a5)
510 #define ERROR6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
511 /* @} */
512
513 /** \name CRITICAL
514  * \ingroup XBT_log
515  * Log something to the current default category under the critical priority.
516  * \param f the format string
517  * \param a1 first argument of the format
518  * \param a2 second argument of the format
519  * \param a3 third argument of the format
520  * \param a4 fourth argument of the format
521  * \param a5 fifth argument of the format
522  * \param a6 sixth argument of the format
523  *
524  * The macros CRITICAL0 ... CRITICAL5 naturally also exist, but are not listed here 
525  * for sake of clarity. They just differ in the number of arguments passed
526  * along with the format string.
527  */
528 /* @{ */
529 #define CRITICAL0(f)                   LOG0(xbt_log_priority_critical, f)
530 #define CRITICAL1(f,a1)                LOG1(xbt_log_priority_critical, f,a1)
531 #define CRITICAL2(f,a1,a2)             LOG2(xbt_log_priority_critical, f,a1,a2)
532 #define CRITICAL3(f,a1,a2,a3)          LOG3(xbt_log_priority_critical, f,a1,a2,a3)
533 #define CRITICAL4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_critical, f,a1,a2,a3,a4)
534 #define CRITICAL5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
535 #define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
536 /* @} */
537
538 #define XBT_IN               LOG1(xbt_log_priority_trace, ">> begin of %s",     _XBT_FUNCTION)
539 #define XBT_IN1(fmt,a)       LOG2(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a)
540 #define XBT_IN2(fmt,a,b)     LOG3(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b)
541 #define XBT_IN3(fmt,a,b,c)   LOG4(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c)
542 #define XBT_IN4(fmt,a,b,c,d) LOG5(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c,d)
543 #define XBT_OUT              LOG1(xbt_log_priority_trace, "<< end of %s",       _XBT_FUNCTION)
544 #define XBT_HERE             LOG0(xbt_log_priority_trace, "-- was here")
545
546 #endif /* ! _XBT_LOG_H_ */