Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
These Makefiles should always be generated to ensure that they're
[simgrid.git] / include / xbt / log.h
index a0dc5cd..0a307f2 100644 (file)
@@ -125,16 +125,16 @@ typedef enum {
  * Creates a new subcategory of the root category.
  */
  
-#if (defined(_WIN32) && !defined(DLL_STATIC))
-# define XBT_LOG_NEW_CATEGORY(catName,desc)  \
+/*#if (defined(_WIN32) && !defined(DLL_STATIC)) KILLME?
+  # define XBT_LOG_NEW_CATEGORY(catName,desc)  \
        XBT_EXPORT_NO_IMPORT(s_xbt_log_category_t) _XBT_LOGV(catName) = {       \
         0, 0, 0,                    \
                #catName, xbt_log_priority_uninitialized, 1, \
         0, 1                                          \
     }
-#else
+#else*/
 # define XBT_LOG_NEW_CATEGORY(catName,desc)  XBT_LOG_NEW_SUBCATEGORY_helper(catName, XBT_LOG_ROOT_CAT, desc)  
-#endif
+//#endif
 
 /**
  * \ingroup XBT_log  
@@ -161,6 +161,7 @@ typedef enum {
  * (used by macros that don't explicitly specify a category).
  */
 
+  /*
 #if (defined(_WIN32) && !defined(DLL_STATIC))
 # define XBT_LOG_NEW_ROOT_SUBCATEGORY(cname,desc) \
        XBT_EXPORT_NO_IMPORT(s_xbt_log_category_t) _XBT_LOGV(cname) = {       \
@@ -168,16 +169,17 @@ typedef enum {
                #cname, xbt_log_priority_uninitialized, 1, \
         0, 1                                          \
     }
-    
 # define XBT_LOG_NEW_DEFAULT_CATEGORY(cname,desc)        \
        XBT_LOG_NEW_ROOT_SUBCATEGORY(cname,desc); \
        XBT_LOG_DEFAULT_CATEGORY(cname)
     
 #else
+*/
 # define XBT_LOG_NEW_DEFAULT_CATEGORY(cname,desc)        \
     XBT_LOG_NEW_CATEGORY(cname,desc);                   \
-    XBT_LOG_DEFAULT_CATEGORY(cname)    
-#endif
+    XBT_LOG_DEFAULT_CATEGORY(cname)
+   
+//#endif
 
 
 
@@ -232,6 +234,7 @@ typedef struct xbt_log_category_s s_xbt_log_category_t,*xbt_log_category_t;
 /*
  * Do NOT access any members of this structure directly. FIXME: move to private?
  */
+#define XBT_LOG_BUFF_SIZE 2048 /* Size of the static string in which we build the log string */
 struct xbt_log_category_s {
   xbt_log_category_t parent;
   xbt_log_category_t firstChild; 
@@ -252,8 +255,8 @@ struct xbt_log_appender_s {
 };
 
 struct xbt_log_layout_s {
-  char *(*do_layout)(xbt_log_layout_t l,
-                    xbt_log_event_t event, const char *fmt);
+  void (*do_layout)(xbt_log_layout_t l,
+                   xbt_log_event_t event, const char *fmt);
   void (*free_) (xbt_log_layout_t l);
   void *data;
 } ;
@@ -265,6 +268,7 @@ struct xbt_log_event_s {
   const char* functionName;
   int lineNum;
   va_list ap;
+  char buffer[XBT_LOG_BUFF_SIZE];
 };
 
 /**
@@ -357,7 +361,7 @@ extern xbt_log_layout_t xbt_log_default_layout;
 /**
  * \ingroup XBT_log 
  * \param catName name of the category
- * \param priority minimal priority to be enabled to return true
+ * \param priority minimal priority to be enabled to return true (must be #e_xbt_log_priority_t)
  * \hideinitializer
  *
  * Returns true if the given priority is enabled for the category.
@@ -397,7 +401,7 @@ extern xbt_log_layout_t xbt_log_default_layout;
 #define _XBT_LOG_PRE(catv, priority) do {                       \
      if (_XBT_LOG_ISENABLEDV(catv, priority)) {                  \
          s_xbt_log_event_t _log_ev =                             \
-             {NULL,priority,__FILE__,_XBT_FUNCTION,__LINE__};    \
+             {NULL,priority,__FILE__,_XBT_FUNCTION,__LINE__}; \
                 _log_ev.cat = &(catv);                           \
               _xbt_log_event_log(&_log_ev                       \