Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Initialize categories through XBT_LOG_CONNECT,
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 28 Mar 2012 14:11:20 +0000 (16:11 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 28 Mar 2012 14:22:33 +0000 (16:22 +0200)
so that they are correctly listed with --help-log-categories.

It's a bit harsh, but I cannot imagine any other way to achieve this.

include/xbt/log.h

index 699acd1..7ff3646 100644 (file)
@@ -118,6 +118,7 @@ typedef enum {
     XBT_LOG_EXTERNAL_CATEGORY(child);                                   \
     XBT_LOG_EXTERNAL_CATEGORY(parent_cat);                              \
     _XBT_LOGV(child).parent = &_XBT_LOGV(parent_cat);                   \
     XBT_LOG_EXTERNAL_CATEGORY(child);                                   \
     XBT_LOG_EXTERNAL_CATEGORY(parent_cat);                              \
     _XBT_LOGV(child).parent = &_XBT_LOGV(parent_cat);                   \
+    _xbt_log_cat_init(&_XBT_LOGV(child), xbt_log_priority_uninitialized); \
   } else ((void)0)
 #else
 # define _XBT_LOG_PARENT_INITIALIZER(parent) &_XBT_LOGV(parent)
   } else ((void)0)
 #else
 # define _XBT_LOG_PARENT_INITIALIZER(parent) &_XBT_LOGV(parent)
@@ -126,6 +127,7 @@ typedef enum {
     XBT_LOG_EXTERNAL_CATEGORY(child);                                   \
     XBT_LOG_EXTERNAL_CATEGORY(parent_cat);                              \
     xbt_assert(_XBT_LOGV(child).parent == &_XBT_LOGV(parent_cat));      \
     XBT_LOG_EXTERNAL_CATEGORY(child);                                   \
     XBT_LOG_EXTERNAL_CATEGORY(parent_cat);                              \
     xbt_assert(_XBT_LOGV(child).parent == &_XBT_LOGV(parent_cat));      \
+    _xbt_log_cat_init(&_XBT_LOGV(child), xbt_log_priority_uninitialized); \
   } else ((void)0)
 #endif
 
   } else ((void)0)
 #endif