Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
__FUNCTION__ is now in the standard
[simgrid.git] / src / xbt / log.c
index 159b85a..d0577f8 100644 (file)
@@ -1,6 +1,6 @@
 /* log - a generic logging facility in the spirit of log4j                  */
 
-/* Copyright (c) 2004-2014. The SimGrid Team.
+/* Copyright (c) 2004-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
 #include <stdio.h>              /* snprintf */
 #include <stdlib.h>             /* snprintf */
 
-#include "portable.h"           /* to get a working stdarg.h */
+#include "src/internal_config.h"
 
-#include "xbt_modinter.h"
+#include "src/xbt_modinter.h"
 
 #include "xbt/misc.h"
 #include "xbt/ex.h"
 #include "xbt/str.h"
 #include "xbt/sysdep.h"
-#include "xbt/log_private.h"
+#include "src/xbt/log_private.h"
 #include "xbt/dynar.h"
 #include "xbt/xbt_os_thread.h"
 
 int xbt_log_no_loc = 0;         /* if set to true (with --log=no_loc), file localization will be omitted (for tesh tests) */
-static xbt_os_rmutex_t log_cat_init_mutex = NULL;
+static xbt_os_mutex_t log_cat_init_mutex = NULL;
 
 /** \addtogroup XBT_log
  *
@@ -104,13 +104,14 @@ higher about the XBT internals.
 \subsection log_app 1.3 Message appenders
 
 The message appenders are the elements in charge of actually displaying the
-message to the user. For now, only two appenders exist: the default one prints
-stuff on stderr while it is possible to create appenders printing to a specific
-file.
+message to the user. For now, four appenders exist: 
+- the default one prints stuff on stderr 
+- file sends the data to a single file
+- rollfile overwrites the file when the file grows too large
+- splitfile creates new files with a specific maximum size
 
-Other are planed (such as the one sending everything to a remote server,
-or the one using only a fixed amount of lines in a file, and rotating content on
-need). One day, for sure ;)
+Other are planed (such as the one sending everything to a remote server) 
+One day, for sure ;)
 
 \subsection log_lay 1.4 Message layouts
 
@@ -358,7 +359,6 @@ Here are the existing format directives:
  - %%l: location where the log event was raised (LOG4J compatible, like '%%F:%%L' -- this is a l as in 'l'etter)
  - %%L: line number where the log event was raised (LOG4J compatible)
  - %%M: function name (LOG4J compatible -- called method name here of course).
-   Defined only when using gcc because there is no __FUNCTION__ elsewhere.
 
  - %%b: full backtrace (Called %%throwable in LOG4J).
    Defined only under windows or when using the GNU libc because backtrace() is not defined
@@ -398,6 +398,17 @@ messages. This is done through the <tt>app</tt> keyword. For example,
 \verbatim --log=root.app:file:mylogfile\endverbatim redirects the output
 to the file mylogfile.
 
+For splitfile appender, the format is 
+\verbatim --log=root.app:splitfile:size:mylogfile_%.format\endverbatim
+
+The size is in bytes, and the % wildcard will be replaced by the number of the
+file. If no % is present, it will be appended at the end.
+
+rollfile appender is also available, it can be used as
+\verbatim --log=root.app:rollfile:size:mylogfile\endverbatim
+When the file grows to be larger than the size, it will be emptied and new log 
+events will be sent at its beginning 
+
 Any appender setup this way have its own layout format (simple one by default),
 so you may have to change it too afterward. Moreover, the additivity of the log category
 is also set to false to prevent log event displayed by this appender to "leak" to any other
@@ -465,8 +476,7 @@ Each category has an optional appender. An appender is a pointer to a
 structure which starts with a pointer to a do_append() function. do_append()
 prints a message to a log.
 
-When a category is passed a message by one of the logging macros, the
-category performs the following actions:
+When a category is passed a message by one of the logging macros, the category performs the following actions:
 
   - if the category has an appender, the message is passed to the
     appender's do_append() function,
@@ -480,11 +490,8 @@ By default, only the root category have an appender, and any other category has
 its additivity set to true. This causes all messages to be logged by the root
 category's appender.
 
-The default appender function currently prints to stderr, and the only other
-existing one writes to the specified file. More would be needed, like the one
-able to send the logs to a remote dedicated server.
-This is on our TODO list for quite a while now, but your help would be
-welcome here, too. */
+The default appender function currently prints to stderr
+*/
 
 xbt_log_appender_t xbt_log_default_appender = NULL;     /* set in log_init */
 xbt_log_layout_t xbt_log_default_layout = NULL; /* set in log_init */
@@ -509,8 +516,7 @@ static void _free_setting(void *s)
   }
 }
 
-static void _xbt_log_cat_apply_set(xbt_log_category_t category,
-                                   xbt_log_setting_t setting);
+static void _xbt_log_cat_apply_set(xbt_log_category_t category, xbt_log_setting_t setting);
 
 const char *xbt_log_priority_names[8] = {
   "NONE",
@@ -532,8 +538,7 @@ s_xbt_log_category_t _XBT_LOGV(XBT_LOG_ROOT_CAT) = {
       0                         /* additivity */
 };
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(log, xbt,
-                                "Loggings from the logging mechanism itself");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(log, xbt, "Loggings from the logging mechanism itself");
 
 /* create the default appender and install it in the root category,
    which were already created (damnit. Too slow little beetle) */
@@ -543,7 +548,7 @@ void xbt_log_preinit(void)
   xbt_log_default_layout = xbt_log_layout_simple_new(NULL);
   _XBT_LOGV(XBT_LOG_ROOT_CAT).appender = xbt_log_default_appender;
   _XBT_LOGV(XBT_LOG_ROOT_CAT).layout = xbt_log_default_layout;
-  log_cat_init_mutex = xbt_os_rmutex_init();
+  log_cat_init_mutex = xbt_os_mutex_init();
 }
 
 static void xbt_log_connect_categories(void)
@@ -553,19 +558,14 @@ static void xbt_log_connect_categories(void)
 
   /* xbt */
   XBT_LOG_CONNECT(xbt);
-  XBT_LOG_CONNECT(graphxml_parse);
   XBT_LOG_CONNECT(log);
   XBT_LOG_CONNECT(module);
-  XBT_LOG_CONNECT(peer);
   XBT_LOG_CONNECT(replay);
   XBT_LOG_CONNECT(strbuff);
   XBT_LOG_CONNECT(xbt_cfg);
   XBT_LOG_CONNECT(xbt_dict);
   XBT_LOG_CONNECT(xbt_dict_cursor);
   XBT_LOG_CONNECT(xbt_dict_elm);
-#ifdef XBT_USE_DEPRECATED
-  XBT_LOG_CONNECT(xbt_dict_multi);
-#endif
   XBT_LOG_CONNECT(xbt_dyn);
   XBT_LOG_CONNECT(xbt_ex);
   XBT_LOG_CONNECT(xbt_fifo);
@@ -575,8 +575,6 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(xbt_mallocator);
   XBT_LOG_CONNECT(xbt_matrix);
   XBT_LOG_CONNECT(xbt_parmap);
-  XBT_LOG_CONNECT(xbt_queue);
-  XBT_LOG_CONNECT(xbt_set);
   XBT_LOG_CONNECT(xbt_sync);
   XBT_LOG_CONNECT(xbt_sync_os);
 
@@ -584,20 +582,14 @@ static void xbt_log_connect_categories(void)
   /* The following categories are only defined in libsimgrid */
 
   /* bindings */
-#ifdef HAVE_LUA
-  XBT_LOG_CONNECT(bindings);
+#if HAVE_LUA
   XBT_LOG_CONNECT(lua);
-  XBT_LOG_CONNECT(lua_comm);
   XBT_LOG_CONNECT(lua_host);
   XBT_LOG_CONNECT(lua_platf);
-  XBT_LOG_CONNECT(lua_process);
-  XBT_LOG_CONNECT(lua_state_cloner);
-  XBT_LOG_CONNECT(lua_task);
-  XBT_LOG_CONNECT(lua_utils);
+  XBT_LOG_CONNECT(lua_debug);
 #endif
 
   /* instr */
-#ifdef HAVE_TRACING
   XBT_LOG_CONNECT(instr);
   XBT_LOG_CONNECT(instr_api);
   XBT_LOG_CONNECT(instr_config);
@@ -611,38 +603,44 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(instr_paje_values);
   XBT_LOG_CONNECT(instr_resource);
   XBT_LOG_CONNECT(instr_routing);
-  XBT_LOG_CONNECT(instr_sd);
   XBT_LOG_CONNECT(instr_surf);
   XBT_LOG_CONNECT(instr_trace);
   XBT_LOG_CONNECT(instr_TI_trace);
-#endif
 
   /* jedule */
-#ifdef HAVE_JEDULE
+#if HAVE_JEDULE
   XBT_LOG_CONNECT(jedule);
   XBT_LOG_CONNECT(jed_out);
   XBT_LOG_CONNECT(jed_sd);
 #endif
 
   /* mc */
-#ifdef HAVE_MC
+#if HAVE_MC
   XBT_LOG_CONNECT(mc);
   XBT_LOG_CONNECT(mc_checkpoint);
   XBT_LOG_CONNECT(mc_comm_determinism);
   XBT_LOG_CONNECT(mc_compare);
   XBT_LOG_CONNECT(mc_diff);
   XBT_LOG_CONNECT(mc_dwarf);
-  XBT_LOG_CONNECT(mc_global);
   XBT_LOG_CONNECT(mc_hash);
-  XBT_LOG_CONNECT(mc_ignore);
   XBT_LOG_CONNECT(mc_liveness);
   XBT_LOG_CONNECT(mc_memory);
-  XBT_LOG_CONNECT(mc_memory_map);
   XBT_LOG_CONNECT(mc_page_snapshot);
   XBT_LOG_CONNECT(mc_request);
   XBT_LOG_CONNECT(mc_safety);
-  XBT_LOG_CONNECT(mc_visited);
+  XBT_LOG_CONNECT(mc_VisitedState);
+  XBT_LOG_CONNECT(mc_client);
+  XBT_LOG_CONNECT(mc_client_api);
+  XBT_LOG_CONNECT(mc_comm_pattern);
+  XBT_LOG_CONNECT(mc_process);
+  XBT_LOG_CONNECT(mc_protocol);
+  XBT_LOG_CONNECT(mc_RegionSnaphot);
+  XBT_LOG_CONNECT(mc_ModelChecker);
+  XBT_LOG_CONNECT(mc_state);
 #endif
+  XBT_LOG_CONNECT(mc_global);
+  XBT_LOG_CONNECT(mc_config);
+  XBT_LOG_CONNECT(mc_record);
 
   /* msg */
   XBT_LOG_CONNECT(msg);
@@ -655,16 +653,18 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(msg_synchro);
   XBT_LOG_CONNECT(msg_task);
   XBT_LOG_CONNECT(msg_vm);
-   
+
+  /* sg */
+  XBT_LOG_CONNECT(sg_host);
+
   /* simdag */
   XBT_LOG_CONNECT(sd);
   XBT_LOG_CONNECT(sd_daxparse);
-#ifdef HAVE_GRAPHVIZ
+#if HAVE_GRAPHVIZ
   XBT_LOG_CONNECT(sd_dotparse);
 #endif
   XBT_LOG_CONNECT(sd_kernel);
   XBT_LOG_CONNECT(sd_task);
-  XBT_LOG_CONNECT(sd_workstation);
 
   /* simix */
   XBT_LOG_CONNECT(simix);
@@ -685,8 +685,6 @@ static void xbt_log_connect_categories(void)
 
   /* surf */
   XBT_LOG_CONNECT(surf);
-  XBT_LOG_CONNECT(platf_generator);
-  XBT_LOG_CONNECT(random);
   XBT_LOG_CONNECT(surf_config);
   XBT_LOG_CONNECT(surf_cpu);
   XBT_LOG_CONNECT(surf_cpu_cas);
@@ -697,16 +695,8 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(surf_lagrange_dichotomy);
   XBT_LOG_CONNECT(surf_maxmin);
   XBT_LOG_CONNECT(surf_network);
-#ifdef HAVE_GTNETS
-  XBT_LOG_CONNECT(surf_network_gtnets);
-  XBT_LOG_CONNECT(surf_network_gtnets_interface);
-  XBT_LOG_CONNECT(surf_network_gtnets_simulator);
-  XBT_LOG_CONNECT(surf_network_gtnets_topology);
-#endif
-#ifdef HAVE_NS3
-  XBT_LOG_CONNECT(surf_network_ns3);
-  XBT_LOG_CONNECT(interface_ns3);
-  XBT_LOG_CONNECT(simulator_ns3);
+#if HAVE_NS3
+  XBT_LOG_CONNECT(ns3);
 #endif
   XBT_LOG_CONNECT(surf_parse);
   XBT_LOG_CONNECT(surf_route);
@@ -721,8 +711,8 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(surf_route_vivaldi);
   XBT_LOG_CONNECT(surf_storage);
   XBT_LOG_CONNECT(surf_trace);
-  XBT_LOG_CONNECT(surf_vm_workstation);
-  XBT_LOG_CONNECT(surf_workstation);
+  XBT_LOG_CONNECT(surf_vm);
+  XBT_LOG_CONNECT(surf_host);
 
 #endif /* simgrid_EXPORTS */
 }
@@ -795,7 +785,7 @@ static void log_cat_exit(xbt_log_category_t cat)
 void xbt_log_postexit(void)
 {
   XBT_VERB("Exiting log");
-  xbt_os_rmutex_destroy(log_cat_init_mutex);
+  xbt_os_mutex_destroy(log_cat_init_mutex);
   xbt_dynar_free(&xbt_log_settings);
   log_cat_exit(&_XBT_LOGV(XBT_LOG_ROOT_CAT));
 }
@@ -810,10 +800,8 @@ void _xbt_log_event_log(xbt_log_event_t ev, const char *fmt, ...)
 {
   xbt_log_category_t cat = ev->cat;
 
-  xbt_assert(ev->priority >= 0,
-             "Negative logging priority naturally forbidden");
-  xbt_assert(ev->priority < sizeof(xbt_log_priority_names),
-             "Priority %d is greater than the biggest allowed value",
+  xbt_assert(ev->priority >= 0, "Negative logging priority naturally forbidden");
+  xbt_assert(ev->priority < sizeof(xbt_log_priority_names), "Priority %d is greater than the biggest allowed value",
              ev->priority);
 
   do {
@@ -822,8 +810,7 @@ void _xbt_log_event_log(xbt_log_event_t ev, const char *fmt, ...)
     if (!appender)
       continue;                 /* No appender, try next */
 
-    xbt_assert(cat->layout,
-               "No valid layout for the appender of category %s", cat->name);
+    xbt_assert(cat->layout, "No valid layout for the appender of category %s", cat->name);
 
     /* First, try with a static buffer */
     if (XBT_LOG_STATIC_BUFFER_SIZE) {
@@ -864,18 +851,15 @@ void _xbt_log_event_log(xbt_log_event_t ev, const char *fmt, ...)
 
 /* NOTE:
  *
- * The standard logging macros use _XBT_LOG_ISENABLED, which calls
- * _xbt_log_cat_init().  Thus, if we want to avoid an infinite
- * recursion, we can not use the standard logging macros in
- * _xbt_log_cat_init(), and in all functions called from it.
+ * The standard logging macros use _XBT_LOG_ISENABLED, which calls _xbt_log_cat_init().  Thus, if we want to avoid an
+ * infinite recursion, we can not use the standard logging macros in _xbt_log_cat_init(), and in all functions called
+ * from it.
  *
- * To circumvent the problem, we define the macro_xbt_log_init() as
- * (0) for the length of the affected functions, and we do not forget
- * to undefine it at the end!
+ * To circumvent the problem, we define the macro_xbt_log_init() as (0) for the length of the affected functions, and
+ * we do not forget to undefine it at the end!
  */
 
-static void _xbt_log_cat_apply_set(xbt_log_category_t category,
-                                   xbt_log_setting_t setting)
+static void _xbt_log_cat_apply_set(xbt_log_category_t category, xbt_log_setting_t setting)
 {
 #define _xbt_log_cat_init(a, b) (0)
 
@@ -883,15 +867,13 @@ static void _xbt_log_cat_apply_set(xbt_log_category_t category,
     xbt_log_threshold_set(category, setting->thresh);
 
     XBT_DEBUG("Apply settings for category '%s': set threshold to %s (=%d)",
-           category->name, xbt_log_priority_names[category->threshold],
-           category->threshold);
+           category->name, xbt_log_priority_names[category->threshold], category->threshold);
   }
 
   if (setting->fmt) {
     xbt_log_layout_set(category, xbt_log_layout_format_new(setting->fmt));
 
-    XBT_DEBUG("Apply settings for category '%s': set format to %s",
-           category->name, setting->fmt);
+    XBT_DEBUG("Apply settings for category '%s': set format to %s", category->name, setting->fmt);
   }
 
   if (setting->additivity != -1) {
@@ -905,30 +887,25 @@ static void _xbt_log_cat_apply_set(xbt_log_category_t category,
     if (!category->layout)
       xbt_log_layout_set(category, xbt_log_layout_simple_new(NULL));
     category->additivity = 0;
-    XBT_DEBUG("Set %p as appender of category '%s'",
-           setting->appender, category->name);
+    XBT_DEBUG("Set %p as appender of category '%s'", setting->appender, category->name);
   }
 #undef _xbt_log_cat_init
 }
 
 /*
- * This gets called the first time a category is referenced and performs the
- * initialization.
+ * This gets called the first time a category is referenced and performs the initialization.
  * Also resets threshold to inherited!
  */
-int _xbt_log_cat_init(xbt_log_category_t category,
-                      e_xbt_log_priority_t priority)
+int _xbt_log_cat_init(xbt_log_category_t category, e_xbt_log_priority_t priority)
 {
 #define _xbt_log_cat_init(a, b) (0)
 
-  if (log_cat_init_mutex != NULL) {
-    xbt_os_rmutex_acquire(log_cat_init_mutex);
-  }
+  if (log_cat_init_mutex != NULL)
+    xbt_os_mutex_acquire(log_cat_init_mutex);
 
   if (category->initialized) {
-    if (log_cat_init_mutex != NULL) {
-      xbt_os_rmutex_release(log_cat_init_mutex);
-    }
+    if (log_cat_init_mutex != NULL)
+      xbt_os_mutex_release(log_cat_init_mutex);
     return priority >= category->threshold;
   }
 
@@ -936,8 +913,7 @@ int _xbt_log_cat_init(xbt_log_category_t category,
   xbt_log_setting_t setting = NULL;
   int found = 0;
 
-  XBT_DEBUG("Initializing category '%s' (firstChild=%s, nextSibling=%s)",
-         category->name,
+  XBT_DEBUG("Initializing category '%s' (firstChild=%s, nextSibling=%s)", category->name,
          (category->firstChild ? category->firstChild->name : "none"),
          (category->nextSibling ? category->nextSibling->name : "none"));
 
@@ -946,14 +922,11 @@ int _xbt_log_cat_init(xbt_log_category_t category,
     category->appender = xbt_log_default_appender;
     category->layout = xbt_log_default_layout;
   } else {
-
     if (!category->parent)
       category->parent = &_XBT_LOGV(XBT_LOG_ROOT_CAT);
 
-    XBT_DEBUG("Set %s (%s) as father of %s ",
-           category->parent->name,
-           (category->parent->initialized ?
-            xbt_log_priority_names[category->parent->threshold] : "uninited"),
+    XBT_DEBUG("Set %s (%s) as father of %s ", category->parent->name,
+           (category->parent->initialized ? xbt_log_priority_names[category->parent->threshold] : "uninited"),
            category->name);
     xbt_log_parent_set(category, category->parent);
 
@@ -971,14 +944,11 @@ int _xbt_log_cat_init(xbt_log_category_t category,
         cpp = cpp->nextSibling;
       }
 
-      XBT_DEBUG("Children of %s: %s; nextSibling: %s",
-             category->parent->name, res,
-             (category->parent->nextSibling ?
-              category->parent->nextSibling->name : "none"));
+      XBT_DEBUG("Children of %s: %s; nextSibling: %s", category->parent->name, res,
+             (category->parent->nextSibling ? category->parent->nextSibling->name : "none"));
 
       free(res);
     }
-
   }
 
   /* Apply the control */
@@ -988,8 +958,7 @@ int _xbt_log_cat_init(xbt_log_category_t category,
 
     xbt_dynar_foreach(xbt_log_settings, cursor, setting) {
       xbt_assert(setting, "Damnit, NULL cat in the list");
-      xbt_assert(setting->catname, "NULL setting(=%p)->catname",
-                 (void *) setting);
+      xbt_assert(setting->catname, "NULL setting(=%p)->catname", (void *) setting);
 
       if (!strcmp(setting->catname, category->name)) {
         found = 1;
@@ -1000,14 +969,12 @@ int _xbt_log_cat_init(xbt_log_category_t category,
 
     if (!found)
       XBT_DEBUG("Category '%s': inherited threshold = %s (=%d)",
-                category->name, xbt_log_priority_names[category->threshold],
-                category->threshold);
+                category->name, xbt_log_priority_names[category->threshold], category->threshold);
   }
 
   category->initialized = 1;
-  if (log_cat_init_mutex != NULL) {
-    xbt_os_rmutex_release(log_cat_init_mutex);
-  }
+  if (log_cat_init_mutex != NULL)
+    xbt_os_mutex_release(log_cat_init_mutex);
   return priority >= category->threshold;
 
 #undef _xbt_log_cat_init
@@ -1020,7 +987,6 @@ void xbt_log_parent_set(xbt_log_category_t cat, xbt_log_category_t parent)
 
   /* if the category is initialized, unlink from current parent */
   if (cat->initialized) {
-
     xbt_log_category_t *cpp = &cat->parent->firstChild;
 
     while (*cpp != cat && *cpp != NULL) {
@@ -1046,31 +1012,25 @@ void xbt_log_parent_set(xbt_log_category_t cat, xbt_log_category_t parent)
 
 static void _set_inherited_thresholds(xbt_log_category_t cat)
 {
-
   xbt_log_category_t child = cat->firstChild;
 
   for (; child != NULL; child = child->nextSibling) {
     if (child->isThreshInherited) {
       if (cat != &_XBT_LOGV(log))
         XBT_VERB("Set category threshold of %s to %s (=%d)",
-              child->name, xbt_log_priority_names[cat->threshold],
-              cat->threshold);
+              child->name, xbt_log_priority_names[cat->threshold], cat->threshold);
       child->threshold = cat->threshold;
       _set_inherited_thresholds(child);
     }
   }
-
-
 }
 
-void xbt_log_threshold_set(xbt_log_category_t cat,
-                           e_xbt_log_priority_t threshold)
+void xbt_log_threshold_set(xbt_log_category_t cat, e_xbt_log_priority_t threshold)
 {
   cat->threshold = threshold;
   cat->isThreshInherited = 0;
 
   _set_inherited_thresholds(cat);
-
 }
 
 static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string)
@@ -1095,7 +1055,6 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string)
   dot = control_string;
   control_string += strcspn(control_string, ":= ");
   eq = control_string;
-  control_string += strcspn(control_string, " ");
 
   if(*dot != '.' && (*eq == '=' || *eq == ':'))
     xbt_die ("Invalid control string '%s'", orig_control_string);
@@ -1120,20 +1079,21 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string)
     }
 
     if(i<XBT_LOG_STATIC_THRESHOLD){
-     THROWF(arg_error, 0,
-             "Priority: %s is above allowed priority : %s (for debug and trace levels, recompile SimGrid with -Denable_debug=ON)",
-             eq + 1, xbt_log_priority_names[XBT_LOG_STATIC_THRESHOLD]);
+     fprintf(stderr,
+         "Priority '%s' (in setting '%s') is above allowed priority '%s'.\n\n"
+         "Compiling SimGrid with -DNDEBUG forbids the levels 'trace' and 'debug'\n"
+         "while -DNLOG forbids any logging, at any level.",
+             eq + 1, name, xbt_log_priority_names[XBT_LOG_STATIC_THRESHOLD]);
+     exit(1);
     }else if (i < xbt_log_priority_infinite) {
       set->thresh = (e_xbt_log_priority_t) i;
     } else {
       THROWF(arg_error, 0,
-             "Unknown priority name: %s (must be one of: trace,debug,verbose,info,warning,error,critical)",
-             eq + 1);
+             "Unknown priority name: %s (must be one of: trace,debug,verbose,info,warning,error,critical)", eq + 1);
     }
     free(neweq);
   } else if (!strncmp(dot + 1, "add", (size_t) (eq - dot - 1)) ||
              !strncmp(dot + 1, "additivity", (size_t) (eq - dot - 1))) {
-
     char *neweq = xbt_strdup(eq + 1);
     char *p = neweq - 1;
 
@@ -1142,8 +1102,7 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string)
         *p -= 'a' - 'A';
       }
     }
-    if (!strcmp(neweq, "ON") || !strcmp(neweq, "YES")
-        || !strcmp(neweq, "1")) {
+    if (!strcmp(neweq, "ON") || !strcmp(neweq, "YES") || !strcmp(neweq, "1")) {
       set->additivity = 1;
     } else {
       set->additivity = 0;
@@ -1151,15 +1110,14 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string)
     free(neweq);
   } else if (!strncmp(dot + 1, "app", (size_t) (eq - dot - 1)) ||
              !strncmp(dot + 1, "appender", (size_t) (eq - dot - 1))) {
-
     char *neweq = xbt_strdup(eq + 1);
 
     if (!strncmp(neweq, "file:", 5)) {
       set->appender = xbt_log_appender_file_new(neweq + 5);
     }else if (!strncmp(neweq, "rollfile:", 9)) {
-               set->appender = xbt_log_appender2_file_new(neweq + 9,1);
+    set->appender = xbt_log_appender2_file_new(neweq + 9,1);
     }else if (!strncmp(neweq, "splitfile:", 10)) {
-               set->appender = xbt_log_appender2_file_new(neweq + 10,0);
+    set->appender = xbt_log_appender2_file_new(neweq + 10,0);
     } else {
       THROWF(arg_error, 0, "Unknown appender log type: '%s'", neweq);
     }
@@ -1168,9 +1126,8 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string)
     set->fmt = xbt_strdup(eq + 1);
   } else {
     char buff[512];
-    snprintf(buff, min(512, eq - dot), "%s", dot + 1);
-    THROWF(arg_error, 0, "Unknown setting of the log category: '%s'",
-           buff);
+    snprintf(buff, MIN(512, eq - dot), "%s", dot + 1);
+    THROWF(arg_error, 0, "Unknown setting of the log category: '%s'", buff);
   }
   set->catname = (char *) xbt_malloc(dot - name + 1);
 
@@ -1181,8 +1138,7 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string)
   return set;
 }
 
-static xbt_log_category_t _xbt_log_cat_searchsub(xbt_log_category_t cat,
-                                                 char *name)
+static xbt_log_category_t _xbt_log_cat_searchsub(xbt_log_category_t cat, char *name)
 {
   xbt_log_category_t child, res;
 
@@ -1210,20 +1166,16 @@ static xbt_log_category_t _xbt_log_cat_searchsub(xbt_log_category_t cat,
  *
  *      ( [category] "." [keyword] ":" value (" ")... )...
  *
- * where [category] is one the category names (see \ref XBT_log_cats for
- * a complete list of the ones defined in the SimGrid library)
- * and keyword is one of the following:
+ * where [category] is one the category names (see \ref XBT_log_cats for a complete list of the ones defined in the
+ * SimGrid library) and keyword is one of the following:
  *
  *    - thres: category's threshold priority. Possible values:
  *             TRACE,DEBUG,VERBOSE,INFO,WARNING,ERROR,CRITICAL
- *    - add or additivity: whether the logging actions must be passed to
- *      the parent category.
+ *    - add or additivity: whether the logging actions must be passed to the parent category.
  *      Possible values: 0, 1, no, yes, on, off.
  *      Default value: yes.
  *    - fmt: the format to use. See \ref log_use_conf_fmt for more information.
- *    - app or appender: the appender to use. See \ref log_use_conf_app for more
- *      information.
- *
+ *    - app or appender: the appender to use. See \ref log_use_conf_app for more information.
  */
 void xbt_log_control_set(const char *control_string)
 {
@@ -1245,8 +1197,7 @@ void xbt_log_control_set(const char *control_string)
   }
   /* some initialization if this is the first time that this get called */
   if (xbt_log_settings == NULL)
-    xbt_log_settings = xbt_dynar_new(sizeof(xbt_log_setting_t),
-                                     _free_setting);
+    xbt_log_settings = xbt_dynar_new(sizeof(xbt_log_setting_t), _free_setting);
 
   /* split the string, and remove empty entries */
   set_strings = xbt_str_split_quoted(control_string);
@@ -1256,21 +1207,18 @@ void xbt_log_control_set(const char *control_string)
     return;
   }
 
-  /* Parse each entry and either use it right now (if the category was already
-     created), or store it for further use */
+  /* Parse each entry and either use it right now (if the category was already created), or store it for further use */
   xbt_dynar_foreach(set_strings, cpt, str) {
     xbt_log_category_t cat = NULL;
 
     set = _xbt_log_parse_setting(str);
-    cat =
-        _xbt_log_cat_searchsub(&_XBT_LOGV(XBT_LOG_ROOT_CAT), set->catname);
+    cat = _xbt_log_cat_searchsub(&_XBT_LOGV(XBT_LOG_ROOT_CAT), set->catname);
 
     if (cat) {
       XBT_DEBUG("Apply directly");
       _xbt_log_cat_apply_set(cat, set);
       _free_setting((void *) &set);
     } else {
-
       XBT_DEBUG("Store for further application");
       XBT_DEBUG("push %p to the settings", (void *) set);
       xbt_dynar_push(xbt_log_settings, &set);
@@ -1293,9 +1241,7 @@ void xbt_log_layout_set(xbt_log_category_t cat, xbt_log_layout_t lay)
 {
 #define _xbt_log_cat_init(a, b) (0)
   if (!cat->appender) {
-    XBT_VERB
-        ("No appender to category %s. Setting the file appender as default",
-         cat->name);
+    XBT_VERB ("No appender to category %s. Setting the file appender as default", cat->name);
     xbt_log_appender_set(cat, xbt_log_appender_file_new(NULL));
   }
   if (cat->layout) {
@@ -1373,8 +1319,7 @@ static int xbt_log_cat_cmp(const void *pa, const void *pb)
   return strcmp(a->name, b->name);
 }
 
-static void xbt_log_help_categories_rec(xbt_log_category_t category,
-                                        const char *prefix)
+static void xbt_log_help_categories_rec(xbt_log_category_t category, const char *prefix)
 {
   char *this_prefix;
   char *child_prefix;