1 /* log - a generic logging facility in the spirit of log4j */
3 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
8 /** @addtogroup XBT_log
9 * @brief A generic logging facility in the spirit of log4j (grounding feature)
14 /** \defgroup XBT_log_cats Existing log categories
16 * \brief (automatically extracted)
18 * This is the list of all existing log categories in SimGrid.
19 * This list was automatically extracted from the source code by
20 * the src/xbt_log_extract_hierarchy utility.
22 * You can thus be certain that it is uptodate, but it may somehow
23 * lack a final manual touch.
24 * Anyway, nothing's perfect ;)
27 /* XBT_LOG_MAYDAY: define this to replace the logging facilities with basic
28 printf function. Useful to debug the logging facilities themselves */
30 /*#define XBT_LOG_MAYDAY*/
39 /**\brief Log priorities
42 * The different existing priorities.
45 xbt_log_priority_none = 0, /* used internally (don't poke with) */
46 xbt_log_priority_trace = 1, /**< enter and return of some functions */
47 xbt_log_priority_debug = 2, /**< crufty output */
48 xbt_log_priority_verbose = 3, /**< verbose output for the user wanting more */
49 xbt_log_priority_info = 4, /**< output about the regular functionning */
50 xbt_log_priority_warning = 5, /**< minor issue encountered */
51 xbt_log_priority_error = 6, /**< issue encountered */
52 xbt_log_priority_critical = 7, /**< major issue encountered */
54 xbt_log_priority_infinite = 8, /**< value for XBT_LOG_STATIC_THRESHOLD to not log */
56 xbt_log_priority_uninitialized = -1 /* used internally (don't poke with) */
57 } e_xbt_log_priority_t;
61 * define NLOG to disable at compilation time any logging request
62 * define NDEBUG to disable at compilation time any logging request of priority below INFO
67 * @def XBT_LOG_STATIC_THRESHOLD
70 * All logging requests with priority < XBT_LOG_STATIC_THRESHOLD are disabled at
71 * compile time, i.e., compiled out.
74 # define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_infinite
78 # define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_verbose
79 # else /* !NLOG && !NDEBUG */
81 # ifndef XBT_LOG_STATIC_THRESHOLD
82 # define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_none
83 # endif /* !XBT_LOG_STATIC_THRESHOLD */
85 #endif /* !defined(NLOG) */
87 /* Transforms a category name to a global variable name. */
88 #define _XBT_LOGV(cat) _XBT_LOG_CONCAT(_simgrid_log_category__, cat)
89 #define _XBT_LOG_CONCAT(x,y) x ## y
91 /* The root of the category hierarchy. */
92 #define XBT_LOG_ROOT_CAT root
94 /* In stric ansi C, we are not allowed to initialize a variable with
95 * a non-constant value. But the whole tree of categories is
96 * connected by setting the address of the parent category as a field
99 * Unfortunately, Visual C builder does not target any standard
100 * compliance, and C99 is not an exception to this unfortunate rule.
102 * So, we work this around by adding a XBT_LOG_CONNECT() macro,
103 * allowing to connect a child to its parent. It should be used
104 * during the initialization of the code, before the child category
107 * When compiling with gcc, this is not necessary (XBT_LOG_CONNECT
108 * defines to nothing). When compiling with MSVC, this is needed if
109 * you don't want to see your child category become a child of root
112 #if defined(__STRICT_ANSI__) || defined(_MSC_VER)
113 # define _XBT_LOG_PARENT_INITIALIZER(parent) NULL
114 # define XBT_LOG_CONNECT(parent_cat,child) _XBT_LOGV(child).parent = &_XBT_LOGV(parent_cat)
116 # define _XBT_LOG_PARENT_INITIALIZER(parent) &_XBT_LOGV(parent)
117 # define XBT_LOG_CONNECT(parent_cat,child) /* xbt_assert(_XBT_LOGV(child).parent == &_XBT_LOGV(parent_cat)) */
120 /* XBT_LOG_NEW_SUBCATEGORY_helper:
121 * Implementation of XBT_LOG_NEW_SUBCATEGORY, which must declare "extern parent" in addition
122 * to avoid an extra declaration of root when XBT_LOG_NEW_SUBCATEGORY is called by
123 * XBT_LOG_NEW_CATEGORY */
124 #define XBT_LOG_NEW_SUBCATEGORY_helper(catName, parent, desc) \
125 XBT_EXPORT_NO_IMPORT(s_xbt_log_category_t) _XBT_LOGV(catName) = { \
126 _XBT_LOG_PARENT_INITIALIZER(parent), \
127 NULL /* firstChild */, \
128 NULL /* nextSibling */, \
130 xbt_log_priority_uninitialized /* threshold */, \
131 1 /* isThreshInherited */, \
132 NULL /* appender */, \
138 * \param catName name of new category
139 * \param parent father of the new category in the tree
140 * \param desc string describing the purpose of this category
143 * Defines a new subcategory of the parent.
145 #define XBT_LOG_NEW_SUBCATEGORY(catName, parent, desc) \
146 extern s_xbt_log_category_t _XBT_LOGV(parent); \
147 XBT_LOG_NEW_SUBCATEGORY_helper(catName, parent, desc) \
151 * \param catName name of new category
152 * \param desc string describing the purpose of this category
155 * Creates a new subcategory of the root category.
157 # define XBT_LOG_NEW_CATEGORY(catName,desc) \
158 XBT_LOG_NEW_SUBCATEGORY_helper(catName, XBT_LOG_ROOT_CAT, desc)
163 * \param cname name of the cat
166 * Indicates which category is the default one.
169 #if defined(XBT_LOG_MAYDAY) || defined(SUPERNOVAE_MODE) /*|| defined (NLOG) * turning logging off */
170 # define XBT_LOG_DEFAULT_CATEGORY(cname)
172 # define XBT_LOG_DEFAULT_CATEGORY(cname) \
173 static xbt_log_category_t _XBT_LOGV(default) _XBT_GNUC_UNUSED = &_XBT_LOGV(cname)
178 * \param cname name of the cat
179 * \param desc string describing the purpose of this category
182 * Creates a new subcategory of the root category and makes it the default
183 * (used by macros that don't explicitly specify a category).
185 # define XBT_LOG_NEW_DEFAULT_CATEGORY(cname,desc) \
186 XBT_LOG_NEW_CATEGORY(cname,desc); \
187 XBT_LOG_DEFAULT_CATEGORY(cname)
191 * \param cname name of the cat
192 * \param parent name of the parent
193 * \param desc string describing the purpose of this category
196 * Creates a new subcategory of the parent category and makes it the default
197 * (used by macros that don't explicitly specify a category).
199 #define XBT_LOG_NEW_DEFAULT_SUBCATEGORY(cname, parent, desc) \
200 XBT_LOG_NEW_SUBCATEGORY(cname, parent, desc); \
201 XBT_LOG_DEFAULT_CATEGORY(cname)
205 * \param cname name of the cat
208 * Indicates that a category you'll use in this file (to get subcategories of it,
209 * for example) really lives in another file.
212 #define XBT_LOG_EXTERNAL_CATEGORY(cname) \
213 extern s_xbt_log_category_t _XBT_LOGV(cname)
217 * \param cname name of the cat
220 * Indicates that the default category of this file was declared in another file.
223 #define XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(cname) \
224 XBT_LOG_EXTERNAL_CATEGORY(cname);\
225 XBT_LOG_DEFAULT_CATEGORY(cname)
227 /* Functions you may call */
229 XBT_PUBLIC(void) xbt_log_control_set(const char *cs);
231 /* Forward declarations */
232 typedef struct xbt_log_appender_s s_xbt_log_appender_t,
234 typedef struct xbt_log_layout_s s_xbt_log_layout_t, *xbt_log_layout_t;
235 typedef struct xbt_log_event_s s_xbt_log_event_t, *xbt_log_event_t;
236 typedef struct xbt_log_category_s s_xbt_log_category_t,
240 * Do NOT access any members of this structure directly. FIXME: move to private?
243 #define XBT_LOG_BUFF_SIZE 16384 /* Size of the static string in which we build the log string */
245 #define XBT_LOG_BUFF_SIZE 2048 /* Size of the static string in which we build the log string */
247 struct xbt_log_category_s {
248 xbt_log_category_t parent;
249 xbt_log_category_t firstChild;
250 xbt_log_category_t nextSibling;
253 int isThreshInherited;
254 xbt_log_appender_t appender;
255 xbt_log_layout_t layout;
259 struct xbt_log_event_s {
260 xbt_log_category_t cat;
261 e_xbt_log_priority_t priority;
262 const char *fileName;
263 const char *functionName;
266 va_list ap_copy; /* need a copy to launch dynamic layouts when the static ones overflowed */
270 char buffer[XBT_LOG_BUFF_SIZE];
275 * \ingroup XBT_log_implem
276 * \param cat the category (not only its name, but the variable)
277 * \param thresholdPriority the priority
279 * Programatically alters a category's threshold priority (don't use).
281 XBT_PUBLIC(void) xbt_log_threshold_set(xbt_log_category_t cat,
286 * \ingroup XBT_log_implem
287 * \param cat the category (not only its name, but the variable)
288 * \param app the appender
290 * Programatically sets the category's appender.
291 * (the prefered interface is throught xbt_log_control_set())
294 XBT_PUBLIC(void) xbt_log_appender_set(xbt_log_category_t cat,
295 xbt_log_appender_t app);
297 * \ingroup XBT_log_implem
298 * \param cat the category (not only its name, but the variable)
299 * \param lay the layout
301 * Programatically sets the category's layout.
302 * (the prefered interface is throught xbt_log_control_set())
305 XBT_PUBLIC(void) xbt_log_layout_set(xbt_log_category_t cat,
306 xbt_log_layout_t lay);
309 * \ingroup XBT_log_implem
310 * \param cat the category (not only its name, but the variable)
311 * \param additivity whether logging actions must be passed to parent.
313 * Programatically sets whether the logging actions must be passed to
314 * the parent category.
315 * (the prefered interface is throught xbt_log_control_set())
318 XBT_PUBLIC(void) xbt_log_additivity_set(xbt_log_category_t cat,
321 /** @brief create a new simple layout
323 * This layout is not as flexible as the pattern one
325 XBT_PUBLIC(xbt_log_layout_t) xbt_log_layout_simple_new(char *arg);
326 XBT_PUBLIC(xbt_log_layout_t) xbt_log_layout_format_new(char *arg);
327 XBT_PUBLIC(xbt_log_appender_t) xbt_log_appender_file_new(char *arg);
330 /* ********************************** */
331 /* Functions that you shouldn't call */
332 /* ********************************** */
333 XBT_PUBLIC(void) _xbt_log_event_log(xbt_log_event_t ev,
335 ...) _XBT_GNUC_PRINTF(2, 3);
337 XBT_PUBLIC(int) _xbt_log_cat_init(xbt_log_category_t category,
338 e_xbt_log_priority_t priority);
341 XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT);
344 extern xbt_log_appender_t xbt_log_default_appender;
345 extern xbt_log_layout_t xbt_log_default_layout;
347 /* ********************** */
348 /* Public functions again */
349 /* ********************** */
353 * \param catName name of the category
354 * \param priority minimal priority to be enabled to return true (must be #e_xbt_log_priority_t)
357 * Returns true if the given priority is enabled for the category.
358 * If you have expensive expressions that are computed outside of the log
359 * command and used only within it, you should make its evaluation conditional
362 #define XBT_LOG_ISENABLED(catName, priority) \
363 _XBT_LOG_ISENABLEDV(_XBT_LOGV(catName), priority)
366 * Helper function that implements XBT_LOG_ISENABLED.
369 * First part is a compile-time constant.
370 * Call to _log_initCat only happens once.
372 #define _XBT_LOG_ISENABLEDV(catv, priority) \
373 (priority >= XBT_LOG_STATIC_THRESHOLD \
374 && priority >= catv.threshold \
375 && (catv.threshold != xbt_log_priority_uninitialized \
376 || _xbt_log_cat_init(&catv, priority)) )
380 * Some kludge macros to ease maintenance. See how they're used below.
382 * IMPLEMENTATION NOTE: To reduce the parameter passing overhead of an enabled
383 * message, the many parameters passed to the logging function are packed in a
384 * structure. Since these values will be usually be passed to at least 3
385 * functions, this is a win.
386 * It also allows adding new values (such as a timestamp) without breaking
388 * Setting the LogEvent's valist member is done inside _log_logEvent.
391 #define _XBT_LOG_PRE(catv, priority) do { \
392 if (_XBT_LOG_ISENABLEDV(catv, priority)) { \
393 s_xbt_log_event_t _log_ev = \
394 {NULL,priority,__FILE__,_XBT_FUNCTION,__LINE__}; \
395 _log_ev.cat = &(catv); \
396 _log_ev.buffer = (char*) calloc(XBT_LOG_BUFF_SIZE + 1, sizeof(char)); \
397 _xbt_log_event_log(&_log_ev
399 #define _XBT_LOG_PRE(catv, priority) do { \
400 if (_XBT_LOG_ISENABLEDV(catv, priority)) { \
401 s_xbt_log_event_t _log_ev = \
402 {NULL,priority,__FILE__,_XBT_FUNCTION,__LINE__}; \
403 _log_ev.cat = &(catv); \
404 _xbt_log_event_log(&_log_ev \
408 #define _XBT_LOG_POST \
415 #ifdef XBT_LOG_MAYDAY
416 # define CLOG0(c, p, f) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
417 # define CLOG1(c, p, f,a1) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)
418 # define CLOG2(c, p, f,a1,a2) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)
419 # define CLOG3(c, p, f,a1,a2,a3) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)
420 # define CLOG4(c, p, f,a1,a2,a3,a4) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)
421 # define CLOG5(c, p, f,a1,a2,a3,a4,a5) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)
422 # 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)
423 # 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)
424 # 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)
425 # 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)
426 # 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)
428 # define CLOG0(c, p, f) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f _XBT_LOG_POST
429 # define CLOG1(c, p, f,a1) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1 _XBT_LOG_POST
430 # define CLOG2(c, p, f,a1,a2) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2 _XBT_LOG_POST
431 # define CLOG3(c, p, f,a1,a2,a3) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3 _XBT_LOG_POST
432 # define CLOG4(c, p, f,a1,a2,a3,a4) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
433 # 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
434 # 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
435 # 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
436 # 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
437 # 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
438 # 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
440 #define CDEBUG0(c, f) CLOG0(c, xbt_log_priority_debug, f)
441 #define CDEBUG1(c, f,a1) CLOG1(c, xbt_log_priority_debug, f,a1)
442 #define CDEBUG2(c, f,a1,a2) CLOG2(c, xbt_log_priority_debug, f,a1,a2)
443 #define CDEBUG3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_debug, f,a1,a2,a3)
444 #define CDEBUG4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_debug, f,a1,a2,a3,a4)
445 #define CDEBUG5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
446 #define CDEBUG6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
447 #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)
448 #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)
449 #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)
452 * \param c the category on which to log
453 * \param f the format string
454 * \param a1 first argument of the format
455 * \param a2 second argument of the format
456 * \param a3 third argument of the format
457 * \param a4 fourth argument of the format
458 * \param a5 fifth argument of the format
459 * \param a6 sixth argument of the format
460 * \param a7 seventh argument of the format
461 * \param a8 eighth argument of the format
462 * \param a9 ninth argument of the format
463 * \param a10 tenth argument of the format
464 * @brief Log an event at the DEBUG priority on the specified category with these args (CDEBUGn exists for any n<10).
466 #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)
468 #define CVERB0(c, f) CLOG0(c, xbt_log_priority_verbose, f)
469 #define CVERB1(c, f,a1) CLOG1(c, xbt_log_priority_verbose, f,a1)
470 #define CVERB2(c, f,a1,a2) CLOG2(c, xbt_log_priority_verbose, f,a1,a2)
471 #define CVERB3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_verbose, f,a1,a2,a3)
472 #define CVERB4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_verbose, f,a1,a2,a3,a4)
473 #define CVERB5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
474 #define CVERB6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
475 #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)
476 #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)
477 #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)
480 * @brief Log an event at the VERB priority on the specified category with these args (CVERBn exists for any n<10).
482 #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)
484 #define CINFO0(c, f) CLOG0(c, xbt_log_priority_info, f)
485 #define CINFO1(c, f,a1) CLOG1(c, xbt_log_priority_info, f,a1)
486 #define CINFO2(c, f,a1,a2) CLOG2(c, xbt_log_priority_info, f,a1,a2)
487 #define CINFO3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_info, f,a1,a2,a3)
488 #define CINFO4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_info, f,a1,a2,a3,a4)
489 #define CINFO5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5)
490 #define CINFO6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
491 #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)
492 #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)
493 #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)
496 * @brief Log an event at the INFO priority on the specified category with these args (CINFOn exists for any n<10).
498 #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)
500 #define CWARN0(c, f) CLOG0(c, xbt_log_priority_warning, f)
501 #define CWARN1(c, f,a1) CLOG1(c, xbt_log_priority_warning, f,a1)
502 #define CWARN2(c, f,a1,a2) CLOG2(c, xbt_log_priority_warning, f,a1,a2)
503 #define CWARN3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_warning, f,a1,a2,a3)
504 #define CWARN4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_warning, f,a1,a2,a3,a4)
505 #define CWARN5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
506 #define CWARN6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
507 #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)
508 #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)
509 #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)
512 * @brief Log an event at the WARN priority on the specified category with these args (CWARNn exists for any n<10).
514 #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)
516 #define CERROR0(c, f) CLOG0(c, xbt_log_priority_error, f)
517 #define CERROR1(c, f,a1) CLOG1(c, xbt_log_priority_error, f,a1)
518 #define CERROR2(c, f,a1,a2) CLOG2(c, xbt_log_priority_error, f,a1,a2)
519 #define CERROR3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_error, f,a1,a2,a3)
520 #define CERROR4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_error, f,a1,a2,a3,a4)
521 #define CERROR5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5)
522 #define CERROR6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
523 #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)
524 #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)
525 #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)
528 * @brief Log an event at the ERROR priority on the specified category with these args (CERRORn exists for any n<10).
530 #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)
532 #define CCRITICAL0(c, f) CLOG0(c, xbt_log_priority_critical, f)
533 #define CCRITICAL1(c, f,a1) CLOG1(c, xbt_log_priority_critical, f,a1)
534 #define CCRITICAL2(c, f,a1,a2) CLOG2(c, xbt_log_priority_critical, f,a1,a2)
535 #define CCRITICAL3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_critical, f,a1,a2,a3)
536 #define CCRITICAL4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_critical, f,a1,a2,a3,a4)
537 #define CCRITICAL5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
538 #define CCRITICAL6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
539 #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)
540 #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)
541 #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)
544 * @brief Log an event at the CRITICAL priority on the specified category with these args (CCRITICALn exists for any n<10).
546 #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)
548 #ifdef XBT_LOG_MAYDAY
549 # define LOG0(p, f) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
550 # define LOG1(p, f,a1) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)
551 # define LOG2(p, f,a1,a2) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)
552 # define LOG3(p, f,a1,a2,a3) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)
553 # define LOG4(p, f,a1,a2,a3,a4) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)
554 # define LOG5(p, f,a1,a2,a3,a4,a5) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)
555 # define LOG6(p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6)
556 # 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)
557 # 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)
558 # 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)
559 # 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)
561 # define LOG0(p, f) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f _XBT_LOG_POST
562 # define LOG1(p, f,a1) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1 _XBT_LOG_POST
563 # define LOG2(p, f,a1,a2) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2 _XBT_LOG_POST
564 # define LOG3(p, f,a1,a2,a3) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3 _XBT_LOG_POST
565 # define LOG4(p, f,a1,a2,a3,a4) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
566 # 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
567 # 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
568 # 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
569 # 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
570 # 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
571 # 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
574 #define DEBUG0(f) LOG0(xbt_log_priority_debug, f)
575 #define DEBUG1(f,a1) LOG1(xbt_log_priority_debug, f,a1)
576 #define DEBUG2(f,a1,a2) LOG2(xbt_log_priority_debug, f,a1,a2)
577 #define DEBUG3(f,a1,a2,a3) LOG3(xbt_log_priority_debug, f,a1,a2,a3)
578 #define DEBUG4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_debug, f,a1,a2,a3,a4)
579 #define DEBUG5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
580 #define DEBUG6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
581 #define DEBUG7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
582 #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)
583 #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)
586 * \param f the format string
587 * \param a1 first argument of the format
588 * \param a2 second argument of the format
589 * \param a3 third argument of the format
590 * \param a4 fourth argument of the format
591 * \param a5 fifth argument of the format
592 * \param a6 sixth argument of the format
593 * \param a7 seventh argument of the format
594 * \param a8 eighth argument of the format
595 * \param a9 ninth argument of the format
596 * \param a10 tenth argument of the format
597 * @brief Log an event at the DEBUG priority on the default category with these args (DEBUGn exists for any n<10)
599 #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)
601 #define VERB0(f) LOG0(xbt_log_priority_verbose, f)
602 #define VERB1(f,a1) LOG1(xbt_log_priority_verbose, f,a1)
603 #define VERB2(f,a1,a2) LOG2(xbt_log_priority_verbose, f,a1,a2)
604 #define VERB3(f,a1,a2,a3) LOG3(xbt_log_priority_verbose, f,a1,a2,a3)
605 #define VERB4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_verbose, f,a1,a2,a3,a4)
606 #define VERB5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
607 #define VERB6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
608 #define VERB7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7)
609 #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)
610 #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)
613 * @brief Log an event at the VERB priority on the default category with these args (VERBn exists for any n<10).
615 #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)
617 #define INFO0(f) LOG0(xbt_log_priority_info, f)
618 #define INFO1(f,a1) LOG1(xbt_log_priority_info, f,a1)
619 #define INFO2(f,a1,a2) LOG2(xbt_log_priority_info, f,a1,a2)
620 #define INFO3(f,a1,a2,a3) LOG3(xbt_log_priority_info, f,a1,a2,a3)
621 #define INFO4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_info, f,a1,a2,a3,a4)
622 #define INFO5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_info, f,a1,a2,a3,a4,a5)
623 #define INFO6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
624 #define INFO7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7)
625 #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)
626 #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)
629 * @brief Log an event at the INFO priority on the default category with these args (INFOn exists for any n<10).
631 #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)
633 #define WARN0(f) LOG0(xbt_log_priority_warning, f)
634 #define WARN1(f,a1) LOG1(xbt_log_priority_warning, f,a1)
635 #define WARN2(f,a1,a2) LOG2(xbt_log_priority_warning, f,a1,a2)
636 #define WARN3(f,a1,a2,a3) LOG3(xbt_log_priority_warning, f,a1,a2,a3)
637 #define WARN4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_warning, f,a1,a2,a3,a4)
638 #define WARN5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
639 #define WARN6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
640 #define WARN7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7)
641 #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)
642 #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)
645 * @brief Log an event at the WARN priority on the default category with these args (WARNn exists for any n<10).
647 #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)
650 #define ERROR0(f) LOG0(xbt_log_priority_error, f)
651 #define ERROR1(f,a1) LOG1(xbt_log_priority_error, f,a1)
652 #define ERROR2(f,a1,a2) LOG2(xbt_log_priority_error, f,a1,a2)
653 #define ERROR3(f,a1,a2,a3) LOG3(xbt_log_priority_error, f,a1,a2,a3)
654 #define ERROR4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_error, f,a1,a2,a3,a4)
655 #define ERROR5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_error, f,a1,a2,a3,a4,a5)
656 #define ERROR6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
657 #define ERROR7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7)
658 #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)
659 #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)
662 * @brief Log an event at the ERROR priority on the default category with these args (ERRORn exists for any n<10).
664 #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)
666 #define CRITICAL0(f) LOG0(xbt_log_priority_critical, f)
667 #define CRITICAL1(f,a1) LOG1(xbt_log_priority_critical, f,a1)
668 #define CRITICAL2(f,a1,a2) LOG2(xbt_log_priority_critical, f,a1,a2)
669 #define CRITICAL3(f,a1,a2,a3) LOG3(xbt_log_priority_critical, f,a1,a2,a3)
670 #define CRITICAL4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_critical, f,a1,a2,a3,a4)
671 #define CRITICAL5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
672 #define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
673 #define CRITICAL7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7)
674 #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)
675 #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)
678 * @brief Log an event at the CRITICAL priority on the default category with these args (CRITICALn exists for any n<10).
680 #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)
684 * @brief Log at TRACE priority that we entered in current function.
686 #define XBT_IN LOG1(xbt_log_priority_trace, ">> begin of %s", _XBT_FUNCTION)
687 #define XBT_IN1(fmt,a) LOG2(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a)
688 #define XBT_IN2(fmt,a,b) LOG3(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b)
689 #define XBT_IN3(fmt,a,b,c) LOG4(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c)
690 #define XBT_IN4(fmt,a,b,c,d) LOG5(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c,d)
693 * @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])
695 #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)
698 * @brief Log at TRACE priority that we exited the current function.
700 #define XBT_OUT LOG1(xbt_log_priority_trace, "<< end of %s", _XBT_FUNCTION)
703 * @brief Log at TRACE priority a message indicating that we reached that point.
705 #define XBT_HERE LOG0(xbt_log_priority_trace, "-- was here")
709 #endif /* ! _XBT_LOG_H_ */