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(_gras_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_PUBLIC_NO_IMPORT(s_xbt_log_category_t) _XBT_LOGV(catName) = { \
102 &_XBT_LOGV(parent), 0, 0, \
103 #catName, xbt_log_priority_uninitialized, 1, \
108 * \param catName name of new category
109 * \param parent father of the new category in the tree
110 * \param desc string describing the purpose of this category
113 * Defines a new subcategory of the parent.
115 #define XBT_LOG_NEW_SUBCATEGORY(catName, parent, desc) \
116 extern s_xbt_log_category_t _XBT_LOGV(parent); \
117 XBT_LOG_NEW_SUBCATEGORY_helper(catName, parent, desc) \
121 * \param catName name of new category
122 * \param desc string describing the purpose of this category
125 * Creates a new subcategory of the root category.
127 #define XBT_LOG_NEW_CATEGORY(catName,desc) XBT_LOG_NEW_SUBCATEGORY_helper(catName, XBT_LOG_ROOT_CAT, desc)
131 * \param cname name of the cat
134 * Indicates which category is the default one.
137 #if defined(XBT_LOG_MAYDAY) /*|| defined (NLOG) * turning logging off */
138 # define XBT_LOG_DEFAULT_CATEGORY(cname)
140 # define XBT_LOG_DEFAULT_CATEGORY(cname) \
141 static xbt_log_category_t _XBT_LOGV(default) _XBT_GNUC_UNUSED = &_XBT_LOGV(cname)
146 * \param cname name of the cat
147 * \param desc string describing the purpose of this category
150 * Creates a new subcategory of the root category and makes it the default
151 * (used by macros that don't explicitly specify a category).
154 #if (defined(_WIN32) && !defined(DLL_STATIC))
155 # define XBT_LOG_NEW_ROOT_SUBCATEGORY(cname,desc) \
156 XBT_PUBLIC_NO_IMPORT(s_xbt_log_category_t) _XBT_LOGV(cname) = { \
158 #cname, xbt_log_priority_uninitialized, 1, \
162 # define XBT_LOG_NEW_DEFAULT_CATEGORY(cname,desc) \
163 XBT_LOG_NEW_ROOT_SUBCATEGORY(cname,desc); \
164 XBT_LOG_DEFAULT_CATEGORY(cname)
167 # define XBT_LOG_NEW_DEFAULT_CATEGORY(cname,desc) \
168 XBT_LOG_NEW_CATEGORY(cname,desc); \
169 XBT_LOG_DEFAULT_CATEGORY(cname)
176 * \param cname name of the cat
177 * \param parent name of the parent
178 * \param desc string describing the purpose of this category
181 * Creates a new subcategory of the parent category and makes it the default
182 * (used by macros that don't explicitly specify a category).
184 #define XBT_LOG_NEW_DEFAULT_SUBCATEGORY(cname, parent, desc) \
185 XBT_LOG_NEW_SUBCATEGORY(cname, parent, desc); \
186 XBT_LOG_DEFAULT_CATEGORY(cname)
190 * \param cname name of the cat
193 * Indicates that a category you'll use in this file (to get subcategories of it,
194 * for example) really lives in another file.
197 #define XBT_LOG_EXTERNAL_CATEGORY(cname) \
198 extern s_xbt_log_category_t _XBT_LOGV(cname)
202 * \param cname name of the cat
205 * Indicates that the default category of this file was declared in another file.
208 #define XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(cname) \
209 XBT_LOG_EXTERNAL_CATEGORY(cname);\
210 XBT_LOG_DEFAULT_CATEGORY(cname)
212 /* Functions you may call */
214 XBT_PUBLIC(void) xbt_log_control_set(const char* cs);
216 /* Forward declarations */
217 typedef struct xbt_log_appender_s s_xbt_log_appender_t,*xbt_log_appender_t;
218 typedef struct xbt_log_event_s s_xbt_log_event_t, *xbt_log_event_t;
219 typedef struct xbt_log_category_s s_xbt_log_category_t,*xbt_log_category_t;
222 * Do NOT access any members of this structure directly. FIXME: move to private?
224 struct xbt_log_category_s {
225 xbt_log_category_t parent;
226 /*@null@*/ xbt_log_category_t firstChild;
227 /*@null@*/ xbt_log_category_t nextSibling;
230 int isThreshInherited;
231 /*@null@*/ xbt_log_appender_t appender;
236 struct xbt_log_appender_s {
237 void (*do_append) (xbt_log_appender_t thisLogAppender,
238 xbt_log_event_t event, const char *fmt);
242 struct xbt_log_event_s {
243 xbt_log_category_t cat;
244 e_xbt_log_priority_t priority;
245 const char* fileName;
246 const char* functionName;
252 * \ingroup XBT_log_implem
253 * \param cat the category (not only its name, but the variable)
254 * \param thresholdPriority the priority
256 * Programatically alters a category's threshold priority (don't use).
258 XBT_PUBLIC(void) xbt_log_threshold_set(xbt_log_category_t cat,
259 e_xbt_log_priority_t thresholdPriority);
262 * \ingroup XBT_log_implem
263 * \param cat the category (not only its name, but the variable)
264 * \param parent the parent cat
266 * Programatically alter a category's parent (don't use).
268 XBT_PUBLIC(void) xbt_log_parent_set(xbt_log_category_t cat,
269 xbt_log_category_t parent);
272 * \ingroup XBT_log_implem
273 * \param cat the category (not only its name, but the variable)
274 * \param app the appender
276 * Programatically sets the category's appender (don't use).
278 XBT_PUBLIC(void) xbt_log_appender_set(xbt_log_category_t cat,
279 xbt_log_appender_t app);
281 /* Functions that you shouldn't call. */
282 XBT_PUBLIC(void) _xbt_log_event_log(xbt_log_event_t ev,
284 ...) _XBT_GNUC_PRINTF(2,3);
286 XBT_PUBLIC(int) _xbt_log_cat_init(e_xbt_log_priority_t priority,
287 xbt_log_category_t category);
290 extern XBT_IMPORT_NO_PUBLIC(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT);
292 XBT_LOG_EXTERNAL_CATEGORY(GRAS);
294 extern xbt_log_appender_t xbt_log_default_appender;
298 * \param catName name of the category
299 * \param priority minimal priority to be enabled to return true
302 * Returns true if the given priority is enabled for the category.
303 * If you have expensive expressions that are computed outside of the log
304 * command and used only within it, you should make its evaluation conditional
307 #define XBT_LOG_ISENABLED(catName, priority) \
308 _XBT_LOG_ISENABLEDV(_XBT_LOGV(catName), priority)
311 * Helper function that implements XBT_LOG_ISENABLED.
314 * First part is a compile-time constant.
315 * Call to _log_initCat only happens once.
317 #define _XBT_LOG_ISENABLEDV(catv, priority) \
318 (priority >= XBT_LOG_STATIC_THRESHOLD \
319 && priority >= catv.threshold \
320 && (catv.threshold != xbt_log_priority_uninitialized \
321 || _xbt_log_cat_init(priority, &catv)) )
325 * Some kludge macros to ease maintenance. See how they're used below.
327 * IMPLEMENTATION NOTE: To reduce the parameter passing overhead of an enabled
328 * message, the many parameters passed to the logging function are packed in a
329 * structure. Since these values will be usually be passed to at least 3
330 * functions, this is a win.
331 * It also allows adding new values (such as a timestamp) without breaking
333 * Setting the LogEvent's valist member is done inside _log_logEvent.
336 #define _XBT_LOG_PRE(catv, priority) do { \
337 if (_XBT_LOG_ISENABLEDV(catv, priority)) { \
338 s_xbt_log_event_t _log_ev = \
339 {NULL,priority,__FILE__,_XBT_FUNCTION,__LINE__}; \
340 _log_ev.cat = &(catv); \
341 _xbt_log_event_log(&_log_ev \
344 #define _XBT_LOG_POST \
351 #ifdef XBT_LOG_MAYDAY
352 # define CLOG0(c, p, f) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
353 # define CLOG1(c, p, f,a1) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)
354 # define CLOG2(c, p, f,a1,a2) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)
355 # define CLOG3(c, p, f,a1,a2,a3) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)
356 # define CLOG4(c, p, f,a1,a2,a3,a4) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)
357 # define CLOG5(c, p, f,a1,a2,a3,a4,a5) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)
358 # 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)
359 # 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)
360 # 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)
361 # 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)
362 # 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)
364 # define CLOG0(c, p, f) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f _XBT_LOG_POST
365 # define CLOG1(c, p, f,a1) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1 _XBT_LOG_POST
366 # define CLOG2(c, p, f,a1,a2) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2 _XBT_LOG_POST
367 # define CLOG3(c, p, f,a1,a2,a3) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3 _XBT_LOG_POST
368 # define CLOG4(c, p, f,a1,a2,a3,a4) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
369 # 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
370 # 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
371 # 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
372 # 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
373 # 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
374 # 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
376 #define CDEBUG0(c, f) CLOG0(c, xbt_log_priority_debug, f)
377 #define CDEBUG1(c, f,a1) CLOG1(c, xbt_log_priority_debug, f,a1)
378 #define CDEBUG2(c, f,a1,a2) CLOG2(c, xbt_log_priority_debug, f,a1,a2)
379 #define CDEBUG3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_debug, f,a1,a2,a3)
380 #define CDEBUG4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_debug, f,a1,a2,a3,a4)
381 #define CDEBUG5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
382 #define CDEBUG6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
383 #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)
384 #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)
385 #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)
388 * \param c the category on which to log
389 * \param f the format string
390 * \param a1 first argument of the format
391 * \param a2 second argument of the format
392 * \param a3 third argument of the format
393 * \param a4 fourth argument of the format
394 * \param a5 fifth argument of the format
395 * \param a6 sixth argument of the format
396 * \param a7 seventh argument of the format
397 * \param a8 eighth argument of the format
398 * \param a9 ninth argument of the format
399 * \param a10 tenth argument of the format
400 * @brief Log an event at the DEBUG priority on the specified category with these args (CDEBUGn exists for any n<10).
402 #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)
404 #define CVERB0(c, f) CLOG0(c, xbt_log_priority_verbose, f)
405 #define CVERB1(c, f,a1) CLOG1(c, xbt_log_priority_verbose, f,a1)
406 #define CVERB2(c, f,a1,a2) CLOG2(c, xbt_log_priority_verbose, f,a1,a2)
407 #define CVERB3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_verbose, f,a1,a2,a3)
408 #define CVERB4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_verbose, f,a1,a2,a3,a4)
409 #define CVERB5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
412 * @brief Log an event at the VERB priority on the specified category with these args (CVERBn exists for any n<6).
414 #define CVERB6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
416 #define CINFO0(c, f) CLOG0(c, xbt_log_priority_info, f)
417 #define CINFO1(c, f,a1) CLOG1(c, xbt_log_priority_info, f,a1)
418 #define CINFO2(c, f,a1,a2) CLOG2(c, xbt_log_priority_info, f,a1,a2)
419 #define CINFO3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_info, f,a1,a2,a3)
420 #define CINFO4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_info, f,a1,a2,a3,a4)
421 #define CINFO5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5)
422 #define CINFO6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
423 #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)
426 * @brief Log an event at the INFO priority on the specified category with these args (CINFOn exists for any n<8).
428 #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)
430 #define CWARN0(c, f) CLOG0(c, xbt_log_priority_warning, f)
431 #define CWARN1(c, f,a1) CLOG1(c, xbt_log_priority_warning, f,a1)
432 #define CWARN2(c, f,a1,a2) CLOG2(c, xbt_log_priority_warning, f,a1,a2)
433 #define CWARN3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_warning, f,a1,a2,a3)
434 #define CWARN4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_warning, f,a1,a2,a3,a4)
435 #define CWARN5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
438 * @brief Log an event at the WARN priority on the specified category with these args (CWARNn exists for any n<6).
440 #define CWARN6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
442 #define CERROR0(c, f) CLOG0(c, xbt_log_priority_error, f)
443 #define CERROR1(c, f,a1) CLOG1(c, xbt_log_priority_error, f,a1)
444 #define CERROR2(c, f,a1,a2) CLOG2(c, xbt_log_priority_error, f,a1,a2)
445 #define CERROR3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_error, f,a1,a2,a3)
446 #define CERROR4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_error, f,a1,a2,a3,a4)
447 #define CERROR5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5)
450 * @brief Log an event at the ERROR priority on the specified category with these args (CERRORn exists for any n<6).
452 #define CERROR6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
454 #define CCRITICAL0(c, f) CLOG0(c, xbt_log_priority_critical, f)
455 #define CCRITICAL1(c, f,a1) CLOG1(c, xbt_log_priority_critical, f,a1)
456 #define CCRITICAL2(c, f,a1,a2) CLOG2(c, xbt_log_priority_critical, f,a1,a2)
457 #define CCRITICAL3(c, f,a1,a2,a3) CLOG3(c, xbt_log_priority_critical, f,a1,a2,a3)
458 #define CCRITICAL4(c, f,a1,a2,a3,a4) CLOG4(c, xbt_log_priority_critical, f,a1,a2,a3,a4)
459 #define CCRITICAL5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
462 * @brief Log an event at the CRITICAL priority on the specified category with these args (CCRITICALn exists for any n<6).
464 #define CCRITICAL6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
466 #ifdef XBT_LOG_MAYDAY
467 # define LOG0(p, f) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
468 # define LOG1(p, f,a1) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)
469 # define LOG2(p, f,a1,a2) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)
470 # define LOG3(p, f,a1,a2,a3) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)
471 # define LOG4(p, f,a1,a2,a3,a4) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)
472 # define LOG5(p, f,a1,a2,a3,a4,a5) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)
473 # define LOG6(p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6)
474 # 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)
475 # 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)
476 # 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)
477 # 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)
479 # define LOG0(p, f) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f _XBT_LOG_POST
480 # define LOG1(p, f,a1) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1 _XBT_LOG_POST
481 # define LOG2(p, f,a1,a2) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2 _XBT_LOG_POST
482 # define LOG3(p, f,a1,a2,a3) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3 _XBT_LOG_POST
483 # define LOG4(p, f,a1,a2,a3,a4) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
484 # 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
485 # 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
486 # 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
487 # 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
488 # 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
489 # 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
492 #define DEBUG0(f) LOG0(xbt_log_priority_debug, f)
493 #define DEBUG1(f,a1) LOG1(xbt_log_priority_debug, f,a1)
494 #define DEBUG2(f,a1,a2) LOG2(xbt_log_priority_debug, f,a1,a2)
495 #define DEBUG3(f,a1,a2,a3) LOG3(xbt_log_priority_debug, f,a1,a2,a3)
496 #define DEBUG4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_debug, f,a1,a2,a3,a4)
497 #define DEBUG5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
498 #define DEBUG6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
499 #define DEBUG7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
500 #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)
501 #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)
504 * \param f the format string
505 * \param a1 first argument of the format
506 * \param a2 second argument of the format
507 * \param a3 third argument of the format
508 * \param a4 fourth argument of the format
509 * \param a5 fifth argument of the format
510 * \param a6 sixth argument of the format
511 * \param a7 seventh argument of the format
512 * \param a8 eighth argument of the format
513 * \param a9 ninth argument of the format
514 * \param a10 tenth argument of the format
515 * @brief Log an event at the DEBUG priority on the default category with these args (DEBUGn exists for any n<10)
517 #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)
519 #define VERB0(f) LOG0(xbt_log_priority_verbose, f)
520 #define VERB1(f,a1) LOG1(xbt_log_priority_verbose, f,a1)
521 #define VERB2(f,a1,a2) LOG2(xbt_log_priority_verbose, f,a1,a2)
522 #define VERB3(f,a1,a2,a3) LOG3(xbt_log_priority_verbose, f,a1,a2,a3)
523 #define VERB4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_verbose, f,a1,a2,a3,a4)
524 #define VERB5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
527 * @brief Log an event at the VERB priority on the default category with these args (VERBn exists for any n<6).
529 #define VERB6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
531 #define INFO0(f) LOG0(xbt_log_priority_info, f)
532 #define INFO1(f,a1) LOG1(xbt_log_priority_info, f,a1)
533 #define INFO2(f,a1,a2) LOG2(xbt_log_priority_info, f,a1,a2)
534 #define INFO3(f,a1,a2,a3) LOG3(xbt_log_priority_info, f,a1,a2,a3)
535 #define INFO4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_info, f,a1,a2,a3,a4)
536 #define INFO5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_info, f,a1,a2,a3,a4,a5)
537 #define INFO6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
538 #define INFO7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7)
541 * @brief Log an event at the INFO priority on the default category with these args (INFOn exists for any n<8).
543 #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)
545 #define WARN0(f) LOG0(xbt_log_priority_warning, f)
546 #define WARN1(f,a1) LOG1(xbt_log_priority_warning, f,a1)
547 #define WARN2(f,a1,a2) LOG2(xbt_log_priority_warning, f,a1,a2)
548 #define WARN3(f,a1,a2,a3) LOG3(xbt_log_priority_warning, f,a1,a2,a3)
549 #define WARN4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_warning, f,a1,a2,a3,a4)
550 #define WARN5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
553 * @brief Log an event at the WARN priority on the default category with these args (WARNn exists for any n<6).
555 #define WARN6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
557 #define ERROR0(f) LOG0(xbt_log_priority_error, f)
558 #define ERROR1(f,a1) LOG1(xbt_log_priority_error, f,a1)
559 #define ERROR2(f,a1,a2) LOG2(xbt_log_priority_error, f,a1,a2)
560 #define ERROR3(f,a1,a2,a3) LOG3(xbt_log_priority_error, f,a1,a2,a3)
561 #define ERROR4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_error, f,a1,a2,a3,a4)
562 #define ERROR5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_error, f,a1,a2,a3,a4,a5)
565 * @brief Log an event at the ERROR priority on the default category with these args (ERRORn exists for any n<6).
567 #define ERROR6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
569 #define CRITICAL0(f) LOG0(xbt_log_priority_critical, f)
570 #define CRITICAL1(f,a1) LOG1(xbt_log_priority_critical, f,a1)
571 #define CRITICAL2(f,a1,a2) LOG2(xbt_log_priority_critical, f,a1,a2)
572 #define CRITICAL3(f,a1,a2,a3) LOG3(xbt_log_priority_critical, f,a1,a2,a3)
573 #define CRITICAL4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_critical, f,a1,a2,a3,a4)
574 #define CRITICAL5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
577 * @brief Log an event at the CRITICAL priority on the default category with these args (CRITICALn exists for any n<6).
579 #define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
583 * @brief Log at TRACE priority that we entered in current function.
585 #define XBT_IN LOG1(xbt_log_priority_trace, ">> begin of %s", _XBT_FUNCTION)
586 #define XBT_IN1(fmt,a) LOG2(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a)
587 #define XBT_IN2(fmt,a,b) LOG3(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b)
588 #define XBT_IN3(fmt,a,b,c) LOG4(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c)
589 #define XBT_IN4(fmt,a,b,c,d) LOG5(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c,d)
592 * @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])
594 #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)
597 * @brief Log at TRACE priority that we exited the current function.
599 #define XBT_OUT LOG1(xbt_log_priority_trace, "<< end of %s", _XBT_FUNCTION)
602 * @brief Log at TRACE priority a message indicating that we reached that point.
604 #define XBT_HERE LOG0(xbt_log_priority_trace, "-- was here")
609 #endif /* ! _XBT_LOG_H_ */