Logo AND Algorithmique Numérique Distribuée

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