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 /** @addtogroup XBT_log
11 * @brief A generic logging facility in the spirit of log4j (grounding feature)
16 /** \defgroup XBT_log_cats Existing log categories
18 * \brief (automatically extracted)
20 * This is the list of all existing log categories in SimGrid.
21 * This list was automatically extracted from the source code by
22 * the src/xbt_log_extract_hierarchy utility.
24 * You can thus be certain that it is uptodate, but it may somehow
25 * lack a final manual touch.
26 * Anyway, nothing's perfect ;)
29 /* XBT_LOG_MAYDAY: define this to replace the logging facilities with basic
30 printf function. Useful to debug the logging facilities themselves */
32 /*#define XBT_LOG_MAYDAY*/
41 /**\brief Log priorities
44 * The different existing priorities.
47 xbt_log_priority_none = 0, /* used internally (don't poke with) */
48 xbt_log_priority_trace = 1, /**< enter and return of some functions */
49 xbt_log_priority_debug = 2, /**< crufty output */
50 xbt_log_priority_verbose = 3, /**< verbose output for the user wanting more */
51 xbt_log_priority_info = 4, /**< output about the regular functionning */
52 xbt_log_priority_warning = 5, /**< minor issue encountered */
53 xbt_log_priority_error = 6, /**< issue encountered */
54 xbt_log_priority_critical = 7, /**< major issue encountered */
56 xbt_log_priority_infinite = 8, /**< value for XBT_LOG_STATIC_THRESHOLD to not log */
58 xbt_log_priority_uninitialized = -1 /* used internally (don't poke with) */
59 } e_xbt_log_priority_t;
63 * define NLOG to disable at compilation time any logging request
64 * define NDEBUG to disable at compilation time any logging request of priority below INFO
69 * @def XBT_LOG_STATIC_THRESHOLD
72 * All logging requests with priority < XBT_LOG_STATIC_THRESHOLD are disabled at
73 * compile time, i.e., compiled out.
76 # define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_infinite
80 # define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_verbose
81 # else /* !NLOG && !NDEBUG */
83 # ifndef XBT_LOG_STATIC_THRESHOLD
84 # define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_none
85 # endif /* !XBT_LOG_STATIC_THRESHOLD */
87 #endif /* !defined(NLOG) */
89 /* Transforms a category name to a global variable name. */
90 #define _XBT_LOGV(cat) _XBT_LOG_CONCAT(_simgrid_this_log_category_does_not_exist__, cat)
91 #define _XBT_LOG_CONCAT(x,y) x ## y
93 /* The root of the category hierarchy. */
94 #define XBT_LOG_ROOT_CAT root
96 /* XBT_LOG_NEW_SUBCATEGORY_helper:
97 * Implementation of XBT_LOG_NEW_SUBCATEGORY, which must declare "extern parent" in addition
98 * to avoid an extra declaration of root when XBT_LOG_NEW_SUBCATEGORY is called by
99 * XBT_LOG_NEW_CATEGORY */
100 #define XBT_LOG_NEW_SUBCATEGORY_helper(catName, parent, desc) \
101 XBT_EXPORT_NO_IMPORT(s_xbt_log_category_t) _XBT_LOGV(catName) = { \
102 &_XBT_LOGV(parent), \
103 NULL /* firstChild */, \
104 NULL /* nextSibling */, \
106 xbt_log_priority_uninitialized /* threshold */, \
107 1 /* isThreshInherited */, \
108 NULL /* appender */, \
114 * \param catName name of new category
115 * \param parent father of the new category in the tree
116 * \param desc string describing the purpose of this category
119 * Defines a new subcategory of the parent.
121 #define XBT_LOG_NEW_SUBCATEGORY(catName, parent, desc) \
122 XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(parent); \
123 XBT_LOG_NEW_SUBCATEGORY_helper(catName, parent, desc) \
127 * \param catName name of new category
128 * \param desc string describing the purpose of this category
131 * Creates a new subcategory of the root category.
133 # define XBT_LOG_NEW_CATEGORY(catName,desc) \
134 XBT_LOG_NEW_SUBCATEGORY_helper(catName, XBT_LOG_ROOT_CAT, desc)
139 * \param cname name of the cat
142 * Indicates which category is the default one.
145 #if defined(XBT_LOG_MAYDAY) /*|| defined (NLOG) * turning logging off */
146 # define XBT_LOG_DEFAULT_CATEGORY(cname)
148 # define XBT_LOG_DEFAULT_CATEGORY(cname) \
149 static xbt_log_category_t _XBT_LOGV(default) _XBT_GNUC_UNUSED = &_XBT_LOGV(cname)
154 * \param cname name of the cat
155 * \param desc string describing the purpose of this category
158 * Creates a new subcategory of the root category and makes it the default
159 * (used by macros that don't explicitly specify a category).
161 /* Damnit Malek. There is no difference between the WINDOWS version and the regular one.
162 * Moreover, portability cruft MUST be kept out of this file. If you need another definition of EXPORT_NO_IMPORT, do so in misc, not here.
163 * Killing your crufty definition once again (I hate dupplicated code). Please do not readd them without a good justification
165 #if (defined(_WIN32) && !defined(DLL_STATIC))
166 # define XBT_LOG_NEW_ROOT_SUBCATEGORY(cname,desc) \
167 XBT_EXPORT_NO_IMPORT(s_xbt_log_category_t) _XBT_LOGV(cname) = { \
169 #cname, xbt_log_priority_uninitialized, 1, \
172 # define XBT_LOG_NEW_DEFAULT_CATEGORY(cname,desc) \
173 XBT_LOG_NEW_ROOT_SUBCATEGORY(cname,desc); \
174 XBT_LOG_DEFAULT_CATEGORY(cname)
178 # define XBT_LOG_NEW_DEFAULT_CATEGORY(cname,desc) \
179 XBT_LOG_NEW_CATEGORY(cname,desc); \
180 XBT_LOG_DEFAULT_CATEGORY(cname)
187 * \param cname name of the cat
188 * \param parent name of the parent
189 * \param desc string describing the purpose of this category
192 * Creates a new subcategory of the parent category and makes it the default
193 * (used by macros that don't explicitly specify a category).
195 #define XBT_LOG_NEW_DEFAULT_SUBCATEGORY(cname, parent, desc) \
196 XBT_LOG_NEW_SUBCATEGORY(cname, parent, desc); \
197 XBT_LOG_DEFAULT_CATEGORY(cname)
201 * \param cname name of the cat
204 * Indicates that a category you'll use in this file (to get subcategories of it,
205 * for example) really lives in another file.
208 #define XBT_LOG_EXTERNAL_CATEGORY(cname) \
209 extern s_xbt_log_category_t _XBT_LOGV(cname)
213 * \param cname name of the cat
216 * Indicates that the default category of this file was declared in another file.
219 #define XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(cname) \
220 XBT_LOG_EXTERNAL_CATEGORY(cname);\
221 XBT_LOG_DEFAULT_CATEGORY(cname)
223 /* Functions you may call */
225 XBT_PUBLIC(void) xbt_log_control_set(const char* cs);
227 /* Forward declarations */
228 typedef struct xbt_log_appender_s s_xbt_log_appender_t,*xbt_log_appender_t;
229 typedef struct xbt_log_layout_s s_xbt_log_layout_t, *xbt_log_layout_t;
230 typedef struct xbt_log_event_s s_xbt_log_event_t, *xbt_log_event_t;
231 typedef struct xbt_log_category_s s_xbt_log_category_t,*xbt_log_category_t;
234 * Do NOT access any members of this structure directly. FIXME: move to private?
236 #define XBT_LOG_BUFF_SIZE 2048 /* Size of the static string in which we build the log string */
237 struct xbt_log_category_s {
238 xbt_log_category_t parent;
239 xbt_log_category_t firstChild;
240 xbt_log_category_t nextSibling;
243 int isThreshInherited;
244 xbt_log_appender_t appender;
245 xbt_log_layout_t layout;
249 struct xbt_log_appender_s {
250 void (*do_append) (xbt_log_appender_t this_appender,
252 void (*free_) (xbt_log_appender_t this_);
256 struct xbt_log_layout_s {
257 void (*do_layout)(xbt_log_layout_t l,
258 xbt_log_event_t event, const char *fmt);
259 void (*free_) (xbt_log_layout_t l);
263 struct xbt_log_event_s {
264 xbt_log_category_t cat;
265 e_xbt_log_priority_t priority;
266 const char* fileName;
267 const char* functionName;
270 char buffer[XBT_LOG_BUFF_SIZE];
274 * \ingroup XBT_log_implem
275 * \param cat the category (not only its name, but the variable)
276 * \param thresholdPriority the priority
278 * Programatically alters a category's threshold priority (don't use).
280 XBT_PUBLIC(void) xbt_log_threshold_set(xbt_log_category_t cat,
281 e_xbt_log_priority_t thresholdPriority);
284 * \ingroup XBT_log_implem
285 * \param cat the category (not only its name, but the variable)
286 * \param parent the parent cat
288 * Programatically alter a category's parent (don't use).
290 XBT_PUBLIC(void) xbt_log_parent_set(xbt_log_category_t cat,
291 xbt_log_category_t parent);
294 * \ingroup XBT_log_implem
295 * \param cat the category (not only its name, but the variable)
296 * \param app the appender
298 * Programatically sets the category's appender.
299 * (the prefered interface is throught xbt_log_control_set())
302 XBT_PUBLIC(void) xbt_log_appender_set(xbt_log_category_t cat,
303 xbt_log_appender_t app);
305 * \ingroup XBT_log_implem
306 * \param cat the category (not only its name, but the variable)
307 * \param lay the layout
309 * Programatically sets the category's layout.
310 * (the prefered interface is throught xbt_log_control_set())
313 XBT_PUBLIC(void) xbt_log_layout_set(xbt_log_category_t cat,
314 xbt_log_layout_t lay);
317 * \ingroup XBT_log_implem
318 * \param cat the category (not only its name, but the variable)
319 * \param additivity whether logging actions must be passed to parent.
321 * Programatically sets whether the logging actions must be passed to
322 * the parent category.
323 * (the prefered interface is throught xbt_log_control_set())
326 XBT_PUBLIC(void) xbt_log_additivity_set(xbt_log_category_t cat,
329 /** @brief create a new simple layout
331 * This layout is not as flexible as the pattern one
333 XBT_PUBLIC(xbt_log_layout_t) xbt_log_layout_simple_new(char*arg);
334 XBT_PUBLIC(xbt_log_layout_t) xbt_log_layout_format_new(char*arg);
335 XBT_PUBLIC(xbt_log_appender_t) xbt_log_appender_file_new(char*arg);
338 /* ********************************** */
339 /* Functions that you shouldn't call */
340 /* ********************************** */
341 XBT_PUBLIC(void) _xbt_log_event_log(xbt_log_event_t ev,
343 ...) _XBT_GNUC_PRINTF(2,3);
345 XBT_PUBLIC(int) _xbt_log_cat_init(xbt_log_category_t category,
346 e_xbt_log_priority_t priority);
349 XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT);
352 extern xbt_log_appender_t xbt_log_default_appender;
353 extern xbt_log_layout_t xbt_log_default_layout;
355 /* ********************** */
356 /* Public functions again */
357 /* ********************** */
361 * \param catName name of the category
362 * \param priority minimal priority to be enabled to return true (must be #e_xbt_log_priority_t)
365 * Returns true if the given priority is enabled for the category.
366 * If you have expensive expressions that are computed outside of the log
367 * command and used only within it, you should make its evaluation conditional
370 #define XBT_LOG_ISENABLED(catName, priority) \
371 _XBT_LOG_ISENABLEDV(_XBT_LOGV(catName), priority)
374 * Helper function that implements XBT_LOG_ISENABLED.
377 * First part is a compile-time constant.
378 * Call to _log_initCat only happens once.
380 #define _XBT_LOG_ISENABLEDV(catv, priority) \
381 (priority >= XBT_LOG_STATIC_THRESHOLD \
382 && priority >= catv.threshold \
383 && (catv.threshold != xbt_log_priority_uninitialized \
384 || _xbt_log_cat_init(&catv, priority)) )
388 * Some kludge macros to ease maintenance. See how they're used below.
390 * IMPLEMENTATION NOTE: To reduce the parameter passing overhead of an enabled
391 * message, the many parameters passed to the logging function are packed in a
392 * structure. Since these values will be usually be passed to at least 3
393 * functions, this is a win.
394 * It also allows adding new values (such as a timestamp) without breaking
396 * Setting the LogEvent's valist member is done inside _log_logEvent.
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 \
407 #define _XBT_LOG_POST \
414 #ifdef XBT_LOG_MAYDAY
415 # define CLOG0(c, p, f) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
416 # define CLOG1(c, p, f,a1) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)
417 # define CLOG2(c, p, f,a1,a2) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)
418 # define CLOG3(c, p, f,a1,a2,a3) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)
419 # define CLOG4(c, p, f,a1,a2,a3,a4) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)
420 # define CLOG5(c, p, f,a1,a2,a3,a4,a5) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)
421 # 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)
422 # 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)
423 # 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)
424 # 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)
425 # 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)
427 # define CLOG0(c, p, f) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f _XBT_LOG_POST
428 # define CLOG1(c, p, f,a1) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1 _XBT_LOG_POST
429 # define CLOG2(c, p, f,a1,a2) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2 _XBT_LOG_POST
430 # define CLOG3(c, p, f,a1,a2,a3) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3 _XBT_LOG_POST
431 # define CLOG4(c, p, f,a1,a2,a3,a4) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
432 # 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
433 # 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
434 # 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
435 # 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
436 # 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
437 # 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
439 #define CDEBUG0(c, f) CLOG0(c, xbt_log_priority_debug, f)
440 #define CDEBUG1(c, f,a1) CLOG1(c, xbt_log_priority_debug, f,a1)
441 #define CDEBUG2(c, f,a1,a2) CLOG2(c, xbt_log_priority_debug, f,a1,a2)
442 #define CDEBUG3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_debug, f,a1,a2,a3)
443 #define CDEBUG4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_debug, f,a1,a2,a3,a4)
444 #define CDEBUG5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
445 #define CDEBUG6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
446 #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)
447 #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)
448 #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)
451 * \param c the category on which to log
452 * \param f the format string
453 * \param a1 first argument of the format
454 * \param a2 second argument of the format
455 * \param a3 third argument of the format
456 * \param a4 fourth argument of the format
457 * \param a5 fifth argument of the format
458 * \param a6 sixth argument of the format
459 * \param a7 seventh argument of the format
460 * \param a8 eighth argument of the format
461 * \param a9 ninth argument of the format
462 * \param a10 tenth argument of the format
463 * @brief Log an event at the DEBUG priority on the specified category with these args (CDEBUGn exists for any n<10).
465 #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)
467 #define CVERB0(c, f) CLOG0(c, xbt_log_priority_verbose, f)
468 #define CVERB1(c, f,a1) CLOG1(c, xbt_log_priority_verbose, f,a1)
469 #define CVERB2(c, f,a1,a2) CLOG2(c, xbt_log_priority_verbose, f,a1,a2)
470 #define CVERB3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_verbose, f,a1,a2,a3)
471 #define CVERB4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_verbose, f,a1,a2,a3,a4)
472 #define CVERB5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
473 #define CVERB6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
474 #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)
475 #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)
476 #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)
479 * @brief Log an event at the VERB priority on the specified category with these args (CVERBn exists for any n<10).
481 #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)
483 #define CINFO0(c, f) CLOG0(c, xbt_log_priority_info, f)
484 #define CINFO1(c, f,a1) CLOG1(c, xbt_log_priority_info, f,a1)
485 #define CINFO2(c, f,a1,a2) CLOG2(c, xbt_log_priority_info, f,a1,a2)
486 #define CINFO3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_info, f,a1,a2,a3)
487 #define CINFO4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_info, f,a1,a2,a3,a4)
488 #define CINFO5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5)
489 #define CINFO6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
490 #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)
491 #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)
492 #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)
495 * @brief Log an event at the INFO priority on the specified category with these args (CINFOn exists for any n<10).
497 #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)
499 #define CWARN0(c, f) CLOG0(c, xbt_log_priority_warning, f)
500 #define CWARN1(c, f,a1) CLOG1(c, xbt_log_priority_warning, f,a1)
501 #define CWARN2(c, f,a1,a2) CLOG2(c, xbt_log_priority_warning, f,a1,a2)
502 #define CWARN3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_warning, f,a1,a2,a3)
503 #define CWARN4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_warning, f,a1,a2,a3,a4)
504 #define CWARN5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
505 #define CWARN6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
506 #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)
507 #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)
508 #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)
511 * @brief Log an event at the WARN priority on the specified category with these args (CWARNn exists for any n<10).
513 #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)
515 #define CERROR0(c, f) CLOG0(c, xbt_log_priority_error, f)
516 #define CERROR1(c, f,a1) CLOG1(c, xbt_log_priority_error, f,a1)
517 #define CERROR2(c, f,a1,a2) CLOG2(c, xbt_log_priority_error, f,a1,a2)
518 #define CERROR3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_error, f,a1,a2,a3)
519 #define CERROR4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_error, f,a1,a2,a3,a4)
520 #define CERROR5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5)
521 #define CERROR6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
522 #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)
523 #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)
524 #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)
527 * @brief Log an event at the ERROR priority on the specified category with these args (CERRORn exists for any n<10).
529 #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)
531 #define CCRITICAL0(c, f) CLOG0(c, xbt_log_priority_critical, f)
532 #define CCRITICAL1(c, f,a1) CLOG1(c, xbt_log_priority_critical, f,a1)
533 #define CCRITICAL2(c, f,a1,a2) CLOG2(c, xbt_log_priority_critical, f,a1,a2)
534 #define CCRITICAL3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_critical, f,a1,a2,a3)
535 #define CCRITICAL4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_critical, f,a1,a2,a3,a4)
536 #define CCRITICAL5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
537 #define CCRITICAL6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
538 #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)
539 #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)
540 #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)
543 * @brief Log an event at the CRITICAL priority on the specified category with these args (CCRITICALn exists for any n<10).
545 #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)
547 #ifdef XBT_LOG_MAYDAY
548 # define LOG0(p, f) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
549 # define LOG1(p, f,a1) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)
550 # define LOG2(p, f,a1,a2) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)
551 # define LOG3(p, f,a1,a2,a3) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)
552 # define LOG4(p, f,a1,a2,a3,a4) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)
553 # define LOG5(p, f,a1,a2,a3,a4,a5) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)
554 # define LOG6(p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6)
555 # 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)
556 # 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)
557 # 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)
558 # 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)
560 # define LOG0(p, f) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f _XBT_LOG_POST
561 # define LOG1(p, f,a1) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1 _XBT_LOG_POST
562 # define LOG2(p, f,a1,a2) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2 _XBT_LOG_POST
563 # define LOG3(p, f,a1,a2,a3) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3 _XBT_LOG_POST
564 # define LOG4(p, f,a1,a2,a3,a4) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
565 # 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
566 # 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
567 # 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
568 # 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
569 # 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
570 # 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
573 #define DEBUG0(f) LOG0(xbt_log_priority_debug, f)
574 #define DEBUG1(f,a1) LOG1(xbt_log_priority_debug, f,a1)
575 #define DEBUG2(f,a1,a2) LOG2(xbt_log_priority_debug, f,a1,a2)
576 #define DEBUG3(f,a1,a2,a3) LOG3(xbt_log_priority_debug, f,a1,a2,a3)
577 #define DEBUG4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_debug, f,a1,a2,a3,a4)
578 #define DEBUG5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
579 #define DEBUG6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
580 #define DEBUG7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
581 #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)
582 #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)
585 * \param f the format string
586 * \param a1 first argument of the format
587 * \param a2 second argument of the format
588 * \param a3 third argument of the format
589 * \param a4 fourth argument of the format
590 * \param a5 fifth argument of the format
591 * \param a6 sixth argument of the format
592 * \param a7 seventh argument of the format
593 * \param a8 eighth argument of the format
594 * \param a9 ninth argument of the format
595 * \param a10 tenth argument of the format
596 * @brief Log an event at the DEBUG priority on the default category with these args (DEBUGn exists for any n<10)
598 #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)
600 #define VERB0(f) LOG0(xbt_log_priority_verbose, f)
601 #define VERB1(f,a1) LOG1(xbt_log_priority_verbose, f,a1)
602 #define VERB2(f,a1,a2) LOG2(xbt_log_priority_verbose, f,a1,a2)
603 #define VERB3(f,a1,a2,a3) LOG3(xbt_log_priority_verbose, f,a1,a2,a3)
604 #define VERB4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_verbose, f,a1,a2,a3,a4)
605 #define VERB5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
606 #define VERB6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
607 #define VERB7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7)
608 #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)
609 #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)
612 * @brief Log an event at the VERB priority on the default category with these args (VERBn exists for any n<10).
614 #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)
616 #define INFO0(f) LOG0(xbt_log_priority_info, f)
617 #define INFO1(f,a1) LOG1(xbt_log_priority_info, f,a1)
618 #define INFO2(f,a1,a2) LOG2(xbt_log_priority_info, f,a1,a2)
619 #define INFO3(f,a1,a2,a3) LOG3(xbt_log_priority_info, f,a1,a2,a3)
620 #define INFO4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_info, f,a1,a2,a3,a4)
621 #define INFO5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_info, f,a1,a2,a3,a4,a5)
622 #define INFO6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
623 #define INFO7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7)
624 #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)
625 #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)
628 * @brief Log an event at the INFO priority on the default category with these args (INFOn exists for any n<10).
630 #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)
632 #define WARN0(f) LOG0(xbt_log_priority_warning, f)
633 #define WARN1(f,a1) LOG1(xbt_log_priority_warning, f,a1)
634 #define WARN2(f,a1,a2) LOG2(xbt_log_priority_warning, f,a1,a2)
635 #define WARN3(f,a1,a2,a3) LOG3(xbt_log_priority_warning, f,a1,a2,a3)
636 #define WARN4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_warning, f,a1,a2,a3,a4)
637 #define WARN5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
638 #define WARN6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
639 #define WARN7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7)
640 #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)
641 #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)
644 * @brief Log an event at the WARN priority on the default category with these args (WARNn exists for any n<10).
646 #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)
649 #define ERROR0(f) LOG0(xbt_log_priority_error, f)
650 #define ERROR1(f,a1) LOG1(xbt_log_priority_error, f,a1)
651 #define ERROR2(f,a1,a2) LOG2(xbt_log_priority_error, f,a1,a2)
652 #define ERROR3(f,a1,a2,a3) LOG3(xbt_log_priority_error, f,a1,a2,a3)
653 #define ERROR4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_error, f,a1,a2,a3,a4)
654 #define ERROR5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_error, f,a1,a2,a3,a4,a5)
655 #define ERROR6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
656 #define ERROR7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7)
657 #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)
658 #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)
661 * @brief Log an event at the ERROR priority on the default category with these args (ERRORn exists for any n<10).
663 #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)
665 #define CRITICAL0(f) LOG0(xbt_log_priority_critical, f)
666 #define CRITICAL1(f,a1) LOG1(xbt_log_priority_critical, f,a1)
667 #define CRITICAL2(f,a1,a2) LOG2(xbt_log_priority_critical, f,a1,a2)
668 #define CRITICAL3(f,a1,a2,a3) LOG3(xbt_log_priority_critical, f,a1,a2,a3)
669 #define CRITICAL4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_critical, f,a1,a2,a3,a4)
670 #define CRITICAL5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
671 #define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
672 #define CRITICAL7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7)
673 #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)
674 #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)
677 * @brief Log an event at the CRITICAL priority on the default category with these args (CRITICALn exists for any n<10).
679 #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)
683 * @brief Log at TRACE priority that we entered in current function.
685 #define XBT_IN LOG1(xbt_log_priority_trace, ">> begin of %s", _XBT_FUNCTION)
686 #define XBT_IN1(fmt,a) LOG2(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a)
687 #define XBT_IN2(fmt,a,b) LOG3(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b)
688 #define XBT_IN3(fmt,a,b,c) LOG4(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c)
689 #define XBT_IN4(fmt,a,b,c,d) LOG5(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c,d)
692 * @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])
694 #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)
697 * @brief Log at TRACE priority that we exited the current function.
699 #define XBT_OUT LOG1(xbt_log_priority_trace, "<< end of %s", _XBT_FUNCTION)
702 * @brief Log at TRACE priority a message indicating that we reached that point.
704 #define XBT_HERE LOG0(xbt_log_priority_trace, "-- was here")
709 #endif /* ! _XBT_LOG_H_ */