Logo AND Algorithmique Numérique Distribuée

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