3 /* log - a generic logging facility in the spirit of log4j */
5 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved. */
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. */
10 /* XBT_LOG_MAYDAY: define this to replace the logging facilities with basic
11 printf function. Useful to debug the logging facilities themselves */
13 /*#define XBT_LOG_MAYDAY*/
20 #include "xbt/sysdep.h"
23 * e_xbt_log_priority_t:
24 * @xbt_log_priority_none: used internally (don't poke with)
25 * @xbt_log_priority_debug: crufty output
26 * @xbt_log_priority_verbose: verbose output for the user wanting more
27 * @xbt_log_priority_info: output about the regular functionning
28 * @xbt_log_priority_warning: minor issue encountered
29 * @xbt_log_priority_error: issue encountered
30 * @xbt_log_priority_critical: major issue encountered
31 * @xbt_log_priority_infinite: value for XBT_LOG_STATIC_THRESHOLD to not log
32 * @xbt_log_priority_uninitialized: used internally (don't poke with)
34 * The different existing priorities.
37 xbt_log_priority_none = 0,
38 xbt_log_priority_trace = 1,
39 xbt_log_priority_debug = 2,
40 xbt_log_priority_verbose = 3,
41 xbt_log_priority_info = 4,
42 xbt_log_priority_warning = 5,
43 xbt_log_priority_error = 6,
44 xbt_log_priority_critical = 7,
46 xbt_log_priority_infinite = 8,
48 xbt_log_priority_uninitialized = -1
49 } e_xbt_log_priority_t;
55 * All logging facilities are disabled at compilation time
60 * XBT_LOG_STATIC_THRESHOLD:
62 * All logging with priority < XBT_LOG_STATIC_THRESHOLD is disabled at
63 * compile time, i.e., compiled out.
66 # define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_infinite
70 # define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_verbose
71 # else /* !NLOG && !NDEBUG */
73 # ifndef XBT_LOG_STATIC_THRESHOLD
74 # define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_none
75 # endif /* !XBT_LOG_STATIC_THRESHOLD */
77 #endif /* !defined(NLOG) */
79 /* Transforms a category name to a global variable name. */
80 #define _XBT_LOGV(cat) _XBT_LOG_CONCAT(_gras_this_log_category_does_not_exist__, cat)
81 #define _XBT_LOG_CONCAT(x,y) x ## y
83 /* The root of the category hierarchy. */
84 #define XBT_LOG_ROOT_CAT root
87 * XBT_LOG_NEW_SUBCATEGORY:
88 * @catName: name of new category
89 * @parent: father of the new category in the tree
90 * @desc: string describing the purpose of this category
92 * Defines a new subcategory of the parent.
94 #define XBT_LOG_NEW_SUBCATEGORY(catName, parent, desc) \
95 extern s_xbt_log_category_t _XBT_LOGV(parent); \
96 s_xbt_log_category_t _XBT_LOGV(catName) = { \
97 &_XBT_LOGV(parent), 0, 0, \
98 #catName, xbt_log_priority_uninitialized, 1, \
103 * XBT_LOG_NEW_CATEGORY:
104 * @catName: name of new category
105 * @desc: string describing the purpose of this category
107 * Creates a new subcategory of the root category.
109 #define XBT_LOG_NEW_CATEGORY(catName,desc) XBT_LOG_NEW_SUBCATEGORY(catName, XBT_LOG_ROOT_CAT, desc)
112 * XBT_LOG_DEFAULT_CATEGORY:
113 * @cname: name of the cat
115 * Indicates which category is the default one.
118 #if defined(XBT_LOG_MAYDAY) /*|| defined (NLOG) * turning logging off */
119 # define XBT_LOG_DEFAULT_CATEGORY(cname)
121 # define XBT_LOG_DEFAULT_CATEGORY(cname) \
122 static xbt_log_category_t _XBT_LOGV(default) = &_XBT_LOGV(cname)
126 * XBT_LOG_NEW_DEFAULT_CATEGORY:
127 * @cname: name of the cat
128 * @desc: string describing the purpose of this category
130 * Creates a new subcategory of the root category and makes it the default
131 * (used by macros that don't explicitly specify a category).
133 #define XBT_LOG_NEW_DEFAULT_CATEGORY(cname,desc) \
134 XBT_LOG_NEW_CATEGORY(cname,desc); \
135 XBT_LOG_DEFAULT_CATEGORY(cname)
138 * XBT_LOG_NEW_DEFAULT_SUBCATEGORY:
139 * @cname: name of the cat
140 * @parent: name of the parent
141 * @desc: string describing the purpose of this category
143 * Creates a new subcategory of the parent category and makes it the default
144 * (used by macros that don't explicitly specify a category).
146 #define XBT_LOG_NEW_DEFAULT_SUBCATEGORY(cname, parent, desc) \
147 XBT_LOG_NEW_SUBCATEGORY(cname, parent, desc); \
148 XBT_LOG_DEFAULT_CATEGORY(cname)
151 * XBT_LOG_EXTERNAL_CATEGORY:
152 * @cname: name of the cat
154 * Indicates that a category you'll use in this file (to get subcategories of it,
155 * for example) really lives in another file.
158 #define XBT_LOG_EXTERNAL_CATEGORY(cname) \
159 extern s_xbt_log_category_t _XBT_LOGV(cname)
161 /* Functions you may call */
163 extern void xbt_log_control_set(const char* cs);
165 /* Forward declarations */
166 typedef struct xbt_log_appender_s s_xbt_log_appender_t,*xbt_log_appender_t;
167 typedef struct xbt_log_event_s s_xbt_log_event_t, *xbt_log_event_t;
168 typedef struct xbt_log_category_s s_xbt_log_category_t,*xbt_log_category_t;
171 * Do NOT access any members of this structure directly. FIXME: move to private?
173 struct xbt_log_category_s {
174 xbt_log_category_t parent;
175 /*@null@*/ xbt_log_category_t firstChild;
176 /*@null@*/ xbt_log_category_t nextSibling;
179 int isThreshInherited;
180 /*@null@*/ xbt_log_appender_t appender;
185 struct xbt_log_appender_s {
186 void (*do_append) (xbt_log_appender_t thisLogAppender,
187 xbt_log_event_t event, const char *fmt);
191 struct xbt_log_event_s {
192 xbt_log_category_t cat;
193 e_xbt_log_priority_t priority;
194 const char* fileName;
195 const char* functionName;
201 * xbt_log_threshold_set:
202 * @cat: the category (not only its name, but the variable)
203 * @thresholdPriority: the priority
205 * Programatically alters a category's threshold priority (don't use).
207 extern void xbt_log_threshold_set(xbt_log_category_t cat,
208 e_xbt_log_priority_t thresholdPriority);
211 * xbt_log_parent_set:
212 * @cat: the category (not only its name, but the variable)
213 * @parent: the parent cat
215 * Programatically alter a category's parent (don't use).
217 extern void xbt_log_parent_set(xbt_log_category_t cat,
218 xbt_log_category_t parent);
221 * xbt_log_appender_set:
222 * @cat: the category (not only its name, but the variable)
225 * Programatically sets the category's appender (don't use).
227 extern void xbt_log_appender_set(xbt_log_category_t cat,
228 xbt_log_appender_t app);
230 /* Functions that you shouldn't call. */
231 extern void _xbt_log_event_log(xbt_log_event_t ev,
233 ...) _XBT_GNUC_PRINTF(2,3);
235 extern int _xbt_log_cat_init(e_xbt_log_priority_t priority,
236 xbt_log_category_t category);
239 extern s_xbt_log_category_t _XBT_LOGV(XBT_LOG_ROOT_CAT);
240 XBT_LOG_EXTERNAL_CATEGORY(GRAS);
241 extern xbt_log_appender_t xbt_log_default_appender;
245 * @catName: name of the category
246 * @priority: minimal priority to be enabled to return true
248 * Returns true if the given priority is enabled for the category.
249 * If you have expensive expressions that are computed outside of the log
250 * command and used only within it, you should make its evaluation conditional
253 #define XBT_LOG_ISENABLED(catName, priority) \
254 _XBT_LOG_ISENABLEDV(_XBT_LOGV(catName), priority)
257 * Helper function that implements XBT_LOG_ISENABLED.
260 * First part is a compile-time constant.
261 * Call to _log_initCat only happens once.
263 #define _XBT_LOG_ISENABLEDV(catv, priority) \
264 (priority >= XBT_LOG_STATIC_THRESHOLD \
265 && priority >= catv.threshold \
266 && (catv.threshold != xbt_log_priority_uninitialized \
267 || _xbt_log_cat_init(priority, &catv)) )
271 * Some kludge macros to ease maintenance. See how they're used below.
273 * IMPLEMENTATION NOTE: To reduce the parameter passing overhead of an enabled
274 * message, the many parameters passed to the logging function are packed in a
275 * structure. Since these values will be usually be passed to at least 3
276 * functions, this is a win.
277 * It also allows adding new values (such as a timestamp) without breaking
279 * Setting the LogEvent's valist member is done inside _log_logEvent.
282 #define _XBT_LOG_PRE(catv, priority) do { \
283 if (_XBT_LOG_ISENABLEDV(catv, priority)) { \
284 s_xbt_log_event_t _log_ev = \
285 {&(catv),priority,__FILE__,_XBT_GNUC_FUNCTION,__LINE__}; \
286 _xbt_log_event_log(&_log_ev
288 #define _XBT_LOG_POST \
295 #ifdef XBT_LOG_MAYDAY
296 # define CLOG0(c, p, f) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
297 # define CLOG1(c, p, f,a1) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)
298 # define CLOG2(c, p, f,a1,a2) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)
299 # define CLOG3(c, p, f,a1,a2,a3) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)
300 # define CLOG4(c, p, f,a1,a2,a3,a4) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)
301 # define CLOG5(c, p, f,a1,a2,a3,a4,a5) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)
302 # 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)
303 # 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)
304 # 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)
306 # define CLOG0(c, p, f) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f _XBT_LOG_POST
307 # define CLOG1(c, p, f,a1) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1 _XBT_LOG_POST
308 # define CLOG2(c, p, f,a1,a2) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2 _XBT_LOG_POST
309 # define CLOG3(c, p, f,a1,a2,a3) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3 _XBT_LOG_POST
310 # define CLOG4(c, p, f,a1,a2,a3,a4) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
311 # 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
312 # 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
313 # 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
314 # 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
317 #define CDEBUG0(c, f) CLOG0(c, xbt_log_priority_debug, f)
318 #define CDEBUG1(c, f,a1) CLOG1(c, xbt_log_priority_debug, f,a1)
319 #define CDEBUG2(c, f,a1,a2) CLOG2(c, xbt_log_priority_debug, f,a1,a2)
320 #define CDEBUG3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_debug, f,a1,a2,a3)
321 #define CDEBUG4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_debug, f,a1,a2,a3,a4)
322 #define CDEBUG5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
323 #define CDEBUG6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
324 #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)
325 #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)
327 #define CVERB0(c, f) CLOG0(c, xbt_log_priority_verbose, f)
328 #define CVERB1(c, f,a1) CLOG1(c, xbt_log_priority_verbose, f,a1)
329 #define CVERB2(c, f,a1,a2) CLOG2(c, xbt_log_priority_verbose, f,a1,a2)
330 #define CVERB3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_verbose, f,a1,a2,a3)
331 #define CVERB4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_verbose, f,a1,a2,a3,a4)
332 #define CVERB5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
333 #define CVERB6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
335 #define CINFO0(c, f) CLOG0(c, xbt_log_priority_info, f)
336 #define CINFO1(c, f,a1) CLOG1(c, xbt_log_priority_info, f,a1)
337 #define CINFO2(c, f,a1,a2) CLOG2(c, xbt_log_priority_info, f,a1,a2)
338 #define CINFO3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_info, f,a1,a2,a3)
339 #define CINFO4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_info, f,a1,a2,a3,a4)
340 #define CINFO5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5)
341 #define CINFO6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
343 #define CWARN0(c, f) CLOG0(c, xbt_log_priority_warning, f)
344 #define CWARN1(c, f,a1) CLOG1(c, xbt_log_priority_warning, f,a1)
345 #define CWARN2(c, f,a1,a2) CLOG2(c, xbt_log_priority_warning, f,a1,a2)
346 #define CWARN3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_warning, f,a1,a2,a3)
347 #define CWARN4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_warning, f,a1,a2,a3,a4)
348 #define CWARN5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
349 #define CWARN6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
351 #define CERROR0(c, f) CLOG0(c, xbt_log_priority_error, f)
352 #define CERROR1(c, f,a1) CLOG1(c, xbt_log_priority_error, f,a1)
353 #define CERROR2(c, f,a1,a2) CLOG2(c, xbt_log_priority_error, f,a1,a2)
354 #define CERROR3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_error, f,a1,a2,a3)
355 #define CERROR4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_error, f,a1,a2,a3,a4)
356 #define CERROR5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5)
357 #define CERROR6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
361 * @c: the category to log into
362 * @f: the format string
363 * @a1: first argument of the format
364 * @a2: second argument of the format
365 * @a3: third argument of the format
366 * @a4: fourth argument of the format
367 * @a5: fifth argument of the format
368 * @a6: sixth argument of the format
370 * Log something to the current default category under the warning priority.
372 * The macros CCRITICAL0 ... CCRITICAL5 naturally also exist, but are not listed here
373 * for sake of clarity. They just differ in the number of arguments passed
374 * along with the format string.
377 #define CCRITICAL0(c, f) CLOG0(c, xbt_log_priority_critical, f)
378 #define CCRITICAL1(c, f,a1) CLOG1(c, xbt_log_priority_critical, f,a1)
379 #define CCRITICAL2(c, f,a1,a2) CLOG2(c, xbt_log_priority_critical, f,a1,a2)
380 #define CCRITICAL3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_critical, f,a1,a2,a3)
381 #define CCRITICAL4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_critical, f,a1,a2,a3,a4)
382 #define CCRITICAL5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
383 #define CCRITICAL6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
385 #ifdef XBT_LOG_MAYDAY
386 # define LOG0(p, f) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
387 # define LOG1(p, f,a1) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)
388 # define LOG2(p, f,a1,a2) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)
389 # define LOG3(p, f,a1,a2,a3) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)
390 # define LOG4(p, f,a1,a2,a3,a4) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)
391 # define LOG5(p, f,a1,a2,a3,a4,a5) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)
392 # define LOG6(p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6)
393 # 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)
394 # 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)
396 # define LOG0(p, f) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f _XBT_LOG_POST
397 # define LOG1(p, f,a1) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1 _XBT_LOG_POST
398 # define LOG2(p, f,a1,a2) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2 _XBT_LOG_POST
399 # define LOG3(p, f,a1,a2,a3) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3 _XBT_LOG_POST
400 # define LOG4(p, f,a1,a2,a3,a4) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
401 # 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
402 # 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
403 # 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
404 # 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
409 * @f: the format string
410 * @a1: first argument of the format
411 * @a2: second argument of the format
412 * @a3: third argument of the format
413 * @a4: fourth argument of the format
414 * @a5: fifth argument of the format
415 * @a6: sixth argument of the format
417 * Log something to the current default category under the debug priority.
419 * The macros DEBUG0 ... DEBUG5 naturally also exist, but are not listed here
420 * for sake of clarity. They just differ in the number of arguments passed
421 * along with the format string.
424 #define DEBUG0(f) LOG0(xbt_log_priority_debug, f)
425 #define DEBUG1(f,a1) LOG1(xbt_log_priority_debug, f,a1)
426 #define DEBUG2(f,a1,a2) LOG2(xbt_log_priority_debug, f,a1,a2)
427 #define DEBUG3(f,a1,a2,a3) LOG3(xbt_log_priority_debug, f,a1,a2,a3)
428 #define DEBUG4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_debug, f,a1,a2,a3,a4)
429 #define DEBUG5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
430 #define DEBUG6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
431 #define DEBUG7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
432 #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)
436 * @f: the format string
437 * @a1: first argument of the format
438 * @a2: second argument of the format
439 * @a3: third argument of the format
440 * @a4: fourth argument of the format
441 * @a5: fifth argument of the format
442 * @a6: sixth argument of the format
444 * Log something to the current default category under the verbose priority.
446 * The macros VERB0 ... VERB5 naturally also exist, but are not listed here
447 * for sake of clarity. They just differ in the number of arguments passed
448 * along with the format string.
451 #define VERB0(f) LOG0(xbt_log_priority_verbose, f)
452 #define VERB1(f,a1) LOG1(xbt_log_priority_verbose, f,a1)
453 #define VERB2(f,a1,a2) LOG2(xbt_log_priority_verbose, f,a1,a2)
454 #define VERB3(f,a1,a2,a3) LOG3(xbt_log_priority_verbose, f,a1,a2,a3)
455 #define VERB4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_verbose, f,a1,a2,a3,a4)
456 #define VERB5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
457 #define VERB6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
461 * @f: the format string
462 * @a1: first argument of the format
463 * @a2: second argument of the format
464 * @a3: third argument of the format
465 * @a4: fourth argument of the format
466 * @a5: fifth argument of the format
467 * @a6: sixth argument of the format
469 * Log something to the current default category under the info priority.
471 * The macros INFO0 ... INFO5 naturally also exist, but are not listed here
472 * for sake of clarity. They just differ in the number of arguments passed
473 * along with the format string.
476 #define INFO0(f) LOG0(xbt_log_priority_info, f)
477 #define INFO1(f,a1) LOG1(xbt_log_priority_info, f,a1)
478 #define INFO2(f,a1,a2) LOG2(xbt_log_priority_info, f,a1,a2)
479 #define INFO3(f,a1,a2,a3) LOG3(xbt_log_priority_info, f,a1,a2,a3)
480 #define INFO4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_info, f,a1,a2,a3,a4)
481 #define INFO5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_info, f,a1,a2,a3,a4,a5)
482 #define INFO6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
486 * @f: the format string
487 * @a1: first argument of the format
488 * @a2: second argument of the format
489 * @a3: third argument of the format
490 * @a4: fourth argument of the format
491 * @a5: fifth argument of the format
492 * @a6: sixth argument of the format
494 * Log something to the current default category under the warning priority.
496 * The macros WARN0 ... WARN5 naturally also exist, but are not listed here
497 * for sake of clarity. They just differ in the number of arguments passed
498 * along with the format string.
501 #define WARN0(f) LOG0(xbt_log_priority_warning, f)
502 #define WARN1(f,a1) LOG1(xbt_log_priority_warning, f,a1)
503 #define WARN2(f,a1,a2) LOG2(xbt_log_priority_warning, f,a1,a2)
504 #define WARN3(f,a1,a2,a3) LOG3(xbt_log_priority_warning, f,a1,a2,a3)
505 #define WARN4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_warning, f,a1,a2,a3,a4)
506 #define WARN5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
507 #define WARN6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
511 * @f: the format string
512 * @a1: first argument of the format
513 * @a2: second argument of the format
514 * @a3: third argument of the format
515 * @a4: fourth argument of the format
516 * @a5: fifth argument of the format
517 * @a6: sixth argument of the format
519 * Log something to the current default category under the error priority.
521 * The macros ERROR0 ... ERROR5 naturally also exist, but are not listed here
522 * for sake of clarity. They just differ in the number of arguments passed
523 * along with the format string.
526 #define ERROR0(f) LOG0(xbt_log_priority_error, f)
527 #define ERROR1(f,a1) LOG1(xbt_log_priority_error, f,a1)
528 #define ERROR2(f,a1,a2) LOG2(xbt_log_priority_error, f,a1,a2)
529 #define ERROR3(f,a1,a2,a3) LOG3(xbt_log_priority_error, f,a1,a2,a3)
530 #define ERROR4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_error, f,a1,a2,a3,a4)
531 #define ERROR5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_error, f,a1,a2,a3,a4,a5)
532 #define ERROR6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
536 * @f: the format string
537 * @a1: first argument of the format
538 * @a2: second argument of the format
539 * @a3: third argument of the format
540 * @a4: fourth argument of the format
541 * @a5: fifth argument of the format
542 * @a6: sixth argument of the format
544 * Log something to the current default category under the critical priority.
546 * The macros CRITICAL0 ... CRITICAL5 naturally also exist, but are not listed here
547 * for sake of clarity. They just differ in the number of arguments passed
548 * along with the format string.
550 #define CRITICAL0(f) LOG0(xbt_log_priority_critical, f)
551 #define CRITICAL1(f,a1) LOG1(xbt_log_priority_critical, f,a1)
552 #define CRITICAL2(f,a1,a2) LOG2(xbt_log_priority_critical, f,a1,a2)
553 #define CRITICAL3(f,a1,a2,a3) LOG3(xbt_log_priority_critical, f,a1,a2,a3)
554 #define CRITICAL4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_critical, f,a1,a2,a3,a4)
555 #define CRITICAL5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
556 #define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
558 #define XBT_IN LOG1(xbt_log_priority_trace, ">> begin of %s", _XBT_GNUC_FUNCTION)
559 #define XBT_IN1(fmt,a) LOG2(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_GNUC_FUNCTION, a)
560 #define XBT_IN2(fmt,a,b) LOG3(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_GNUC_FUNCTION, a,b)
561 #define XBT_IN3(fmt,a,b,c) LOG4(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_GNUC_FUNCTION, a,b,c)
562 #define XBT_IN4(fmt,a,b,c,d) LOG5(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_GNUC_FUNCTION, a,b,c,d)
563 #define XBT_OUT LOG1(xbt_log_priority_trace, "<< end of %s", _XBT_GNUC_FUNCTION)
564 #define XBT_HERE LOG0(xbt_log_priority_trace, "-- was here")
566 #endif /* ! _XBT_LOG_H_ */