1 /* log - a generic logging facility in the spirit of log4j */
3 /* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
9 /** @addtogroup XBT_log
10 * @brief A generic logging facility in the spirit of log4j (grounding feature)
15 /** \defgroup XBT_log_cats Existing log categories
17 * \brief (automatically extracted)
19 * This is the list of all existing log categories in SimGrid.
20 * This list was automatically extracted from the source code by
21 * the src/xbt_log_extract_hierarchy utility.
23 * You can thus be certain that it is uptodate, but it may somehow
24 * lack a final manual touch.
25 * Anyway, nothing's perfect ;)
28 /* XBT_LOG_MAYDAY: define this to replace the logging facilities with basic
29 printf function. Useful to debug the logging facilities themselves */
31 /*#define XBT_LOG_MAYDAY*/
40 /**\brief Log priorities
43 * The different existing priorities.
46 xbt_log_priority_none = 0, /* used internally (don't poke with) */
47 xbt_log_priority_trace = 1, /**< enter and return of some functions */
48 xbt_log_priority_debug = 2, /**< crufty output */
49 xbt_log_priority_verbose = 3, /**< verbose output for the user wanting more */
50 xbt_log_priority_info = 4, /**< output about the regular functionning */
51 xbt_log_priority_warning = 5, /**< minor issue encountered */
52 xbt_log_priority_error = 6, /**< issue encountered */
53 xbt_log_priority_critical = 7, /**< major issue encountered */
55 xbt_log_priority_infinite = 8, /**< value for XBT_LOG_STATIC_THRESHOLD to not log */
57 xbt_log_priority_uninitialized = -1 /* used internally (don't poke with) */
58 } e_xbt_log_priority_t;
62 * define NLOG to disable at compilation time any logging request
63 * define NDEBUG to disable at compilation time any logging request of priority below INFO
68 * @def XBT_LOG_STATIC_THRESHOLD
71 * All logging requests with priority < XBT_LOG_STATIC_THRESHOLD are disabled at
72 * compile time, i.e., compiled out.
75 # define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_infinite
79 # define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_verbose
80 # else /* !NLOG && !NDEBUG */
82 # ifndef XBT_LOG_STATIC_THRESHOLD
83 # define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_none
84 # endif /* !XBT_LOG_STATIC_THRESHOLD */
86 #endif /* !defined(NLOG) */
88 /* Transforms a category name to a global variable name. */
89 #define _XBT_LOGV(cat) _XBT_LOG_CONCAT(_simgrid_log_category__, cat)
90 #define _XBT_LOG_CONCAT(x,y) x ## y
92 /* The root of the category hierarchy. */
93 #define XBT_LOG_ROOT_CAT root
95 /* In strict ansi C, we are not allowed to initialize a variable with
96 * a non-constant value. But the whole tree of categories is
97 * connected by setting the address of the parent category as a field
100 * Unfortunately, Visual C builder does not target any standard
101 * compliance, and C99 is not an exception to this unfortunate rule.
103 * So, we work this around by adding a XBT_LOG_CONNECT() macro,
104 * allowing to connect a child to its parent. It should be used
105 * during the initialization of the code, before the child category
108 * When compiling with gcc, this is not necessary (XBT_LOG_CONNECT
109 * defines to nothing). When compiling with MSVC, this is needed if
110 * you don't want to see your child category become a child of root
113 #if defined(__STRICT_ANSI__) || defined(_MSC_VER)
114 # define _XBT_LOG_PARENT_INITIALIZER(parent) NULL
115 # define XBT_LOG_CONNECT(parent_cat,child) _XBT_LOGV(child).parent = &_XBT_LOGV(parent_cat)
117 # define _XBT_LOG_PARENT_INITIALIZER(parent) &_XBT_LOGV(parent)
118 # define XBT_LOG_CONNECT(parent_cat,child) /* xbt_assert(_XBT_LOGV(child).parent == &_XBT_LOGV(parent_cat)) */
121 /* XBT_LOG_NEW_SUBCATEGORY_helper:
122 * Implementation of XBT_LOG_NEW_SUBCATEGORY, which must declare "extern parent" in addition
123 * to avoid an extra declaration of root when XBT_LOG_NEW_SUBCATEGORY is called by
124 * XBT_LOG_NEW_CATEGORY */
125 #define XBT_LOG_NEW_SUBCATEGORY_helper(catName, parent, desc) \
126 XBT_EXPORT_NO_IMPORT(s_xbt_log_category_t) _XBT_LOGV(catName) = { \
127 _XBT_LOG_PARENT_INITIALIZER(parent), \
128 NULL /* firstChild */, \
129 NULL /* nextSibling */, \
131 xbt_log_priority_uninitialized /* threshold */, \
132 1 /* isThreshInherited */, \
133 NULL /* appender */, \
139 * \param catName name of new category
140 * \param parent father of the new category in the tree
141 * \param desc string describing the purpose of this category
144 * Defines a new subcategory of the parent.
146 #define XBT_LOG_NEW_SUBCATEGORY(catName, parent, desc) \
147 extern s_xbt_log_category_t _XBT_LOGV(parent); \
148 XBT_LOG_NEW_SUBCATEGORY_helper(catName, parent, desc) \
152 * \param catName name of new category
153 * \param desc string describing the purpose of this category
156 * Creates a new subcategory of the root category.
158 # define XBT_LOG_NEW_CATEGORY(catName,desc) \
159 XBT_LOG_NEW_SUBCATEGORY_helper(catName, XBT_LOG_ROOT_CAT, desc)
164 * \param cname name of the cat
167 * Indicates which category is the default one.
170 #if defined(XBT_LOG_MAYDAY) || defined(SUPERNOVAE_MODE) /*|| defined (NLOG) * turning logging off */
171 # define XBT_LOG_DEFAULT_CATEGORY(cname)
173 # define XBT_LOG_DEFAULT_CATEGORY(cname) \
174 static xbt_log_category_t _XBT_LOGV(default) _XBT_GNUC_UNUSED = &_XBT_LOGV(cname)
179 * \param cname name of the cat
180 * \param desc string describing the purpose of this category
183 * Creates a new subcategory of the root category and makes it the default
184 * (used by macros that don't explicitly specify a category).
186 # define XBT_LOG_NEW_DEFAULT_CATEGORY(cname,desc) \
187 XBT_LOG_NEW_CATEGORY(cname,desc); \
188 XBT_LOG_DEFAULT_CATEGORY(cname)
192 * \param cname name of the cat
193 * \param parent name of the parent
194 * \param desc string describing the purpose of this category
197 * Creates a new subcategory of the parent category and makes it the default
198 * (used by macros that don't explicitly specify a category).
200 #define XBT_LOG_NEW_DEFAULT_SUBCATEGORY(cname, parent, desc) \
201 XBT_LOG_NEW_SUBCATEGORY(cname, parent, desc); \
202 XBT_LOG_DEFAULT_CATEGORY(cname)
206 * \param cname name of the cat
209 * Indicates that a category you'll use in this file (to get subcategories of it,
210 * for example) really lives in another file.
213 #define XBT_LOG_EXTERNAL_CATEGORY(cname) \
214 extern s_xbt_log_category_t _XBT_LOGV(cname)
218 * \param cname name of the cat
221 * Indicates that the default category of this file was declared in another file.
224 #define XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(cname) \
225 XBT_LOG_EXTERNAL_CATEGORY(cname);\
226 XBT_LOG_DEFAULT_CATEGORY(cname)
228 /* Functions you may call */
230 XBT_PUBLIC(void) xbt_log_control_set(const char *cs);
232 /* Forward declarations */
233 typedef struct xbt_log_appender_s s_xbt_log_appender_t,
235 typedef struct xbt_log_layout_s s_xbt_log_layout_t, *xbt_log_layout_t;
236 typedef struct xbt_log_event_s s_xbt_log_event_t, *xbt_log_event_t;
237 typedef struct xbt_log_category_s s_xbt_log_category_t,
241 * Do NOT access any members of this structure directly. FIXME: move to private?
244 #define XBT_LOG_BUFF_SIZE 16384 /* Size of the static string in which we build the log string */
246 #define XBT_LOG_BUFF_SIZE 2048 /* Size of the static string in which we build the log string */
248 struct xbt_log_category_s {
249 xbt_log_category_t parent;
250 xbt_log_category_t firstChild;
251 xbt_log_category_t nextSibling;
254 int isThreshInherited;
255 xbt_log_appender_t appender;
256 xbt_log_layout_t layout;
260 struct xbt_log_event_s {
261 xbt_log_category_t cat;
262 e_xbt_log_priority_t priority;
263 const char *fileName;
264 const char *functionName;
267 va_list ap_copy; /* need a copy to launch dynamic layouts when the static ones overflowed */
271 char buffer[XBT_LOG_BUFF_SIZE];
276 * \ingroup XBT_log_implem
277 * \param cat the category (not only its name, but the variable)
278 * \param thresholdPriority the priority
280 * Programatically alters a category's threshold priority (don't use).
282 XBT_PUBLIC(void) xbt_log_threshold_set(xbt_log_category_t cat,
287 * \ingroup XBT_log_implem
288 * \param cat the category (not only its name, but the variable)
289 * \param app the appender
291 * Programatically sets the category's appender.
292 * (the prefered interface is throught xbt_log_control_set())
295 XBT_PUBLIC(void) xbt_log_appender_set(xbt_log_category_t cat,
296 xbt_log_appender_t app);
298 * \ingroup XBT_log_implem
299 * \param cat the category (not only its name, but the variable)
300 * \param lay the layout
302 * Programatically sets the category's layout.
303 * (the prefered interface is throught xbt_log_control_set())
306 XBT_PUBLIC(void) xbt_log_layout_set(xbt_log_category_t cat,
307 xbt_log_layout_t lay);
310 * \ingroup XBT_log_implem
311 * \param cat the category (not only its name, but the variable)
312 * \param additivity whether logging actions must be passed to parent.
314 * Programatically sets whether the logging actions must be passed to
315 * the parent category.
316 * (the prefered interface is throught xbt_log_control_set())
319 XBT_PUBLIC(void) xbt_log_additivity_set(xbt_log_category_t cat,
322 /** @brief create a new simple layout
324 * This layout is not as flexible as the pattern one
326 XBT_PUBLIC(xbt_log_layout_t) xbt_log_layout_simple_new(char *arg);
327 XBT_PUBLIC(xbt_log_layout_t) xbt_log_layout_format_new(char *arg);
328 XBT_PUBLIC(xbt_log_appender_t) xbt_log_appender_file_new(char *arg);
331 /* ********************************** */
332 /* Functions that you shouldn't call */
333 /* ********************************** */
334 XBT_PUBLIC(void) _xbt_log_event_log(xbt_log_event_t ev,
336 ...) _XBT_GNUC_PRINTF(2, 3);
338 XBT_PUBLIC(int) _xbt_log_cat_init(xbt_log_category_t category,
339 e_xbt_log_priority_t priority);
342 XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT);
345 extern xbt_log_appender_t xbt_log_default_appender;
346 extern xbt_log_layout_t xbt_log_default_layout;
348 /* ********************** */
349 /* Public functions again */
350 /* ********************** */
354 * \param catName name of the category
355 * \param priority minimal priority to be enabled to return true (must be #e_xbt_log_priority_t)
358 * Returns true if the given priority is enabled for the category.
359 * If you have expensive expressions that are computed outside of the log
360 * command and used only within it, you should make its evaluation conditional
363 #define XBT_LOG_ISENABLED(catName, priority) \
364 _XBT_LOG_ISENABLEDV(_XBT_LOGV(catName), priority)
367 * Helper function that implements XBT_LOG_ISENABLED.
370 * First part is a compile-time constant.
371 * Call to _log_initCat only happens once.
373 #define _XBT_LOG_ISENABLEDV(catv, priority) \
374 (priority >= XBT_LOG_STATIC_THRESHOLD \
375 && priority >= catv.threshold \
376 && (catv.threshold != xbt_log_priority_uninitialized \
377 || _xbt_log_cat_init(&catv, priority)) )
381 * Some kludge macros to ease maintenance. See how they're used below.
383 * IMPLEMENTATION NOTE: To reduce the parameter passing overhead of an enabled
384 * message, the many parameters passed to the logging function are packed in a
385 * structure. Since these values will be usually be passed to at least 3
386 * functions, this is a win.
387 * It also allows adding new values (such as a timestamp) without breaking
389 * Setting the LogEvent's valist member is done inside _log_logEvent.
392 #define _XBT_LOG_PRE(catv, priority) do { \
393 if (_XBT_LOG_ISENABLEDV(catv, priority)) { \
394 s_xbt_log_event_t _log_ev = \
395 {NULL,priority,__FILE__,_XBT_FUNCTION,__LINE__}; \
396 _log_ev.cat = &(catv); \
397 _log_ev.buffer = (char*) calloc(XBT_LOG_BUFF_SIZE + 1, sizeof(char)); \
398 _xbt_log_event_log(&_log_ev
400 #define _XBT_LOG_PRE(catv, priority) do { \
401 if (_XBT_LOG_ISENABLEDV(catv, priority)) { \
402 s_xbt_log_event_t _log_ev = \
403 {NULL,priority,__FILE__,_XBT_FUNCTION,__LINE__}; \
404 _log_ev.cat = &(catv); \
405 _xbt_log_event_log(&_log_ev \
409 #define _XBT_LOG_POST \
416 #ifdef XBT_LOG_MAYDAY
417 # define CLOG0(c, p, f) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
418 # define CLOG1(c, p, f,a1) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)
419 # define CLOG2(c, p, f,a1,a2) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)
420 # define CLOG3(c, p, f,a1,a2,a3) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)
421 # define CLOG4(c, p, f,a1,a2,a3,a4) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)
422 # define CLOG5(c, p, f,a1,a2,a3,a4,a5) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)
423 # 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)
424 # 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)
425 # 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)
426 # define CLOG9(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8,a9)
427 # define CLOG10(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
429 # define CLOG0(c, p, f) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f _XBT_LOG_POST
430 # define CLOG1(c, p, f,a1) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1 _XBT_LOG_POST
431 # define CLOG2(c, p, f,a1,a2) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2 _XBT_LOG_POST
432 # define CLOG3(c, p, f,a1,a2,a3) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3 _XBT_LOG_POST
433 # define CLOG4(c, p, f,a1,a2,a3,a4) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
434 # 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
435 # 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
436 # 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
437 # 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
438 # define CLOG9(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8,a9 _XBT_LOG_POST
439 # define CLOG10(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 _XBT_LOG_POST
441 #define CDEBUG0(c, f) CLOG0(c, xbt_log_priority_debug, f)
442 #define CDEBUG1(c, f,a1) CLOG1(c, xbt_log_priority_debug, f,a1)
443 #define CDEBUG2(c, f,a1,a2) CLOG2(c, xbt_log_priority_debug, f,a1,a2)
444 #define CDEBUG3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_debug, f,a1,a2,a3)
445 #define CDEBUG4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_debug, f,a1,a2,a3,a4)
446 #define CDEBUG5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
447 #define CDEBUG6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
448 #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)
449 #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)
450 #define CDEBUG9(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) CLOG9(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
453 * \param c the category on which to log
454 * \param f the format string
455 * \param a1 first argument of the format
456 * \param a2 second argument of the format
457 * \param a3 third argument of the format
458 * \param a4 fourth argument of the format
459 * \param a5 fifth argument of the format
460 * \param a6 sixth argument of the format
461 * \param a7 seventh argument of the format
462 * \param a8 eighth argument of the format
463 * \param a9 ninth argument of the format
464 * \param a10 tenth argument of the format
465 * @brief Log an event at the DEBUG priority on the specified category with these args (CDEBUGn exists for any n<10).
467 #define CDEBUG10(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) CLOG10(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
469 #define CVERB0(c, f) CLOG0(c, xbt_log_priority_verbose, f)
470 #define CVERB1(c, f,a1) CLOG1(c, xbt_log_priority_verbose, f,a1)
471 #define CVERB2(c, f,a1,a2) CLOG2(c, xbt_log_priority_verbose, f,a1,a2)
472 #define CVERB3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_verbose, f,a1,a2,a3)
473 #define CVERB4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_verbose, f,a1,a2,a3,a4)
474 #define CVERB5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
475 #define CVERB6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
476 #define CVERB7(c, f,a1,a2,a3,a4,a5,a6,a7) CLOG7(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7)
477 #define CVERB8(c, f,a1,a2,a3,a4,a5,a6,a7,a8) CLOG8(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7,a8)
478 #define CVERB9(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) CLOG9(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
481 * @brief Log an event at the VERB priority on the specified category with these args (CVERBn exists for any n<10).
483 #define CVERB10(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) CLOG10(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
485 #define CINFO0(c, f) CLOG0(c, xbt_log_priority_info, f)
486 #define CINFO1(c, f,a1) CLOG1(c, xbt_log_priority_info, f,a1)
487 #define CINFO2(c, f,a1,a2) CLOG2(c, xbt_log_priority_info, f,a1,a2)
488 #define CINFO3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_info, f,a1,a2,a3)
489 #define CINFO4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_info, f,a1,a2,a3,a4)
490 #define CINFO5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5)
491 #define CINFO6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
492 #define CINFO7(c, f,a1,a2,a3,a4,a5,a6,a7) CLOG7(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7)
493 #define CINFO8(c, f,a1,a2,a3,a4,a5,a6,a7,a8) CLOG8(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7,a8)
494 #define CINFO9(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) CLOG9(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
497 * @brief Log an event at the INFO priority on the specified category with these args (CINFOn exists for any n<10).
499 #define CINFO10(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) CLOG10(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
501 #define CWARN0(c, f) CLOG0(c, xbt_log_priority_warning, f)
502 #define CWARN1(c, f,a1) CLOG1(c, xbt_log_priority_warning, f,a1)
503 #define CWARN2(c, f,a1,a2) CLOG2(c, xbt_log_priority_warning, f,a1,a2)
504 #define CWARN3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_warning, f,a1,a2,a3)
505 #define CWARN4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_warning, f,a1,a2,a3,a4)
506 #define CWARN5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
507 #define CWARN6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
508 #define CWARN7(c, f,a1,a2,a3,a4,a5,a6,a7) CLOG7(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7)
509 #define CWARN8(c, f,a1,a2,a3,a4,a5,a6,a7,a8) CLOG8(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7,a8)
510 #define CWARN9(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) CLOG9(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
513 * @brief Log an event at the WARN priority on the specified category with these args (CWARNn exists for any n<10).
515 #define CWARN10(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) CLOG10(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,10)
517 #define CERROR0(c, f) CLOG0(c, xbt_log_priority_error, f)
518 #define CERROR1(c, f,a1) CLOG1(c, xbt_log_priority_error, f,a1)
519 #define CERROR2(c, f,a1,a2) CLOG2(c, xbt_log_priority_error, f,a1,a2)
520 #define CERROR3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_error, f,a1,a2,a3)
521 #define CERROR4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_error, f,a1,a2,a3,a4)
522 #define CERROR5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5)
523 #define CERROR6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
524 #define CERROR7(c, f,a1,a2,a3,a4,a5,a6,a7) CLOG7(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7)
525 #define CERROR8(c, f,a1,a2,a3,a4,a5,a6,a7,a8) CLOG8(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7,a8)
526 #define CERROR9(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) CLOG9(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
529 * @brief Log an event at the ERROR priority on the specified category with these args (CERRORn exists for any n<10).
531 #define CERROR10(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) CLOG10(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
533 #define CCRITICAL0(c, f) CLOG0(c, xbt_log_priority_critical, f)
534 #define CCRITICAL1(c, f,a1) CLOG1(c, xbt_log_priority_critical, f,a1)
535 #define CCRITICAL2(c, f,a1,a2) CLOG2(c, xbt_log_priority_critical, f,a1,a2)
536 #define CCRITICAL3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_critical, f,a1,a2,a3)
537 #define CCRITICAL4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_critical, f,a1,a2,a3,a4)
538 #define CCRITICAL5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
539 #define CCRITICAL6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
540 #define CCRITICAL7(c, f,a1,a2,a3,a4,a5,a6,a7) CLOG7(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7)
541 #define CCRITICAL8(c, f,a1,a2,a3,a4,a5,a6,a7,a8) CLOG8(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7,a8)
542 #define CCRITICAL9(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) CLOG9(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
545 * @brief Log an event at the CRITICAL priority on the specified category with these args (CCRITICALn exists for any n<10).
547 #define CCRITICAL10(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) CLOG10(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
549 #ifdef XBT_LOG_MAYDAY
550 # define LOG0(p, f) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
551 # define LOG1(p, f,a1) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)
552 # define LOG2(p, f,a1,a2) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)
553 # define LOG3(p, f,a1,a2,a3) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)
554 # define LOG4(p, f,a1,a2,a3,a4) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)
555 # define LOG5(p, f,a1,a2,a3,a4,a5) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)
556 # define LOG6(p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6)
557 # 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)
558 # 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)
559 # define LOG9(p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8,a9)
560 # define LOG10(p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
562 # define LOG0(p, f) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f _XBT_LOG_POST
563 # define LOG1(p, f,a1) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1 _XBT_LOG_POST
564 # define LOG2(p, f,a1,a2) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2 _XBT_LOG_POST
565 # define LOG3(p, f,a1,a2,a3) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3 _XBT_LOG_POST
566 # define LOG4(p, f,a1,a2,a3,a4) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
567 # 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
568 # 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
569 # 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
570 # 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
571 # define LOG9(p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8,a9 _XBT_LOG_POST
572 # define LOG10(p,f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 _XBT_LOG_POST
575 #define DEBUG0(f) LOG0(xbt_log_priority_debug, f)
576 #define DEBUG1(f,a1) LOG1(xbt_log_priority_debug, f,a1)
577 #define DEBUG2(f,a1,a2) LOG2(xbt_log_priority_debug, f,a1,a2)
578 #define DEBUG3(f,a1,a2,a3) LOG3(xbt_log_priority_debug, f,a1,a2,a3)
579 #define DEBUG4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_debug, f,a1,a2,a3,a4)
580 #define DEBUG5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
581 #define DEBUG6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
582 #define DEBUG7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
583 #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)
584 #define DEBUG9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) LOG9(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
587 * \param f the format string
588 * \param a1 first argument of the format
589 * \param a2 second argument of the format
590 * \param a3 third argument of the format
591 * \param a4 fourth argument of the format
592 * \param a5 fifth argument of the format
593 * \param a6 sixth argument of the format
594 * \param a7 seventh argument of the format
595 * \param a8 eighth argument of the format
596 * \param a9 ninth argument of the format
597 * \param a10 tenth argument of the format
598 * @brief Log an event at the DEBUG priority on the default category with these args (DEBUGn exists for any n<10)
600 #define DEBUG10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) LOG10(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
602 #define VERB0(f) LOG0(xbt_log_priority_verbose, f)
603 #define VERB1(f,a1) LOG1(xbt_log_priority_verbose, f,a1)
604 #define VERB2(f,a1,a2) LOG2(xbt_log_priority_verbose, f,a1,a2)
605 #define VERB3(f,a1,a2,a3) LOG3(xbt_log_priority_verbose, f,a1,a2,a3)
606 #define VERB4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_verbose, f,a1,a2,a3,a4)
607 #define VERB5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
608 #define VERB6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
609 #define VERB7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7)
610 #define VERB8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7,a8)
611 #define VERB9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) LOG9(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
614 * @brief Log an event at the VERB priority on the default category with these args (VERBn exists for any n<10).
616 #define VERB10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) LOG10(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
618 #define INFO0(f) LOG0(xbt_log_priority_info, f)
619 #define INFO1(f,a1) LOG1(xbt_log_priority_info, f,a1)
620 #define INFO2(f,a1,a2) LOG2(xbt_log_priority_info, f,a1,a2)
621 #define INFO3(f,a1,a2,a3) LOG3(xbt_log_priority_info, f,a1,a2,a3)
622 #define INFO4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_info, f,a1,a2,a3,a4)
623 #define INFO5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_info, f,a1,a2,a3,a4,a5)
624 #define INFO6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
625 #define INFO7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7)
626 #define INFO8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7,a8)
627 #define INFO9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) LOG9(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
630 * @brief Log an event at the INFO priority on the default category with these args (INFOn exists for any n<10).
632 #define INFO10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) LOG10(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
634 #define WARN0(f) LOG0(xbt_log_priority_warning, f)
635 #define WARN1(f,a1) LOG1(xbt_log_priority_warning, f,a1)
636 #define WARN2(f,a1,a2) LOG2(xbt_log_priority_warning, f,a1,a2)
637 #define WARN3(f,a1,a2,a3) LOG3(xbt_log_priority_warning, f,a1,a2,a3)
638 #define WARN4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_warning, f,a1,a2,a3,a4)
639 #define WARN5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
640 #define WARN6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
641 #define WARN7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7)
642 #define WARN8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7,a8)
643 #define WARN9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) LOG9(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
646 * @brief Log an event at the WARN priority on the default category with these args (WARNn exists for any n<10).
648 #define WARN10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) LOG10(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
651 #define ERROR0(f) LOG0(xbt_log_priority_error, f)
652 #define ERROR1(f,a1) LOG1(xbt_log_priority_error, f,a1)
653 #define ERROR2(f,a1,a2) LOG2(xbt_log_priority_error, f,a1,a2)
654 #define ERROR3(f,a1,a2,a3) LOG3(xbt_log_priority_error, f,a1,a2,a3)
655 #define ERROR4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_error, f,a1,a2,a3,a4)
656 #define ERROR5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_error, f,a1,a2,a3,a4,a5)
657 #define ERROR6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
658 #define ERROR7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7)
659 #define ERROR8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7,a8)
660 #define ERROR9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) LOG9(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
663 * @brief Log an event at the ERROR priority on the default category with these args (ERRORn exists for any n<10).
665 #define ERROR10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) LOG10(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
667 #define CRITICAL0(f) LOG0(xbt_log_priority_critical, f)
668 #define CRITICAL1(f,a1) LOG1(xbt_log_priority_critical, f,a1)
669 #define CRITICAL2(f,a1,a2) LOG2(xbt_log_priority_critical, f,a1,a2)
670 #define CRITICAL3(f,a1,a2,a3) LOG3(xbt_log_priority_critical, f,a1,a2,a3)
671 #define CRITICAL4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_critical, f,a1,a2,a3,a4)
672 #define CRITICAL5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
673 #define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
674 #define CRITICAL7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7)
675 #define CRITICAL8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7,a8)
676 #define CRITICAL9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) LOG9(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
679 * @brief Log an event at the CRITICAL priority on the default category with these args (CRITICALn exists for any n<10).
681 #define CRITICAL10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) LOG10(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
685 * @brief Log at TRACE priority that we entered in current function.
687 #define XBT_IN LOG1(xbt_log_priority_trace, ">> begin of %s", _XBT_FUNCTION)
688 #define XBT_IN1(fmt,a) LOG2(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a)
689 #define XBT_IN2(fmt,a,b) LOG3(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b)
690 #define XBT_IN3(fmt,a,b,c) LOG4(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c)
691 #define XBT_IN4(fmt,a,b,c,d) LOG5(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c,d)
694 * @brief Log at TRACE priority that we entered in current function, appending a user specified format taking 5 args (XBT_INn exists for all n in [1,6])
696 #define XBT_IN5(fmt,a,b,c,d,e) LOG6(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c,d,e)
699 * @brief Log at TRACE priority that we exited the current function.
701 #define XBT_OUT LOG1(xbt_log_priority_trace, "<< end of %s", _XBT_FUNCTION)
704 * @brief Log at TRACE priority a message indicating that we reached that point.
706 #define XBT_HERE LOG0(xbt_log_priority_trace, "-- was here")
710 #endif /* ! _XBT_LOG_H_ */