Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Partially revert 2ad536e710c5936ff8e525e4bbb5e7046f292aac (Simplify the library initi...
[simgrid.git] / src / xbt / log.cpp
1 /* log - a generic logging facility in the spirit of log4j                  */
2
3 /* Copyright (c) 2004-2023. The SimGrid Team. All rights reserved.          */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 #include "src/xbt/log_private.hpp"
9 #include "xbt/string.hpp"
10 #include "xbt/sysdep.h"
11
12 #include <algorithm>
13 #include <array>
14 #include <boost/tokenizer.hpp>
15 #include <cstring>
16 #include <mutex>
17 #include <string>
18 #include <vector>
19
20 int xbt_log_no_loc = 0; /* if set to true (with --log=no_loc), file localization will be omitted (for tesh tests) */
21
22 struct xbt_log_setting_t {
23   std::string catname;
24   std::string fmt;
25   e_xbt_log_priority_t thresh = xbt_log_priority_uninitialized;
26   int additivity              = -1;
27   xbt_log_appender_t appender = nullptr;
28 };
29
30 // This function is here to avoid static initialization order fiasco
31 static auto& xbt_log_settings()
32 {
33   static std::vector<xbt_log_setting_t> value;
34   return value;
35 }
36
37 constexpr std::array<const char*, xbt_log_priority_infinite> xbt_log_priority_names{
38     {"NONE", "TRACE", "DEBUG", "VERBOSE", "INFO", "WARNING", "ERROR", "CRITICAL"}};
39
40 s_xbt_log_category_t _XBT_LOGV(XBT_LOG_ROOT_CAT) = {
41     nullptr /*parent */,
42     nullptr /* firstChild */,
43     nullptr /* nextSibling */,
44     "root",
45     "The common ancestor for all categories",
46     0 /*initialized */,
47     xbt_log_priority_uninitialized /* threshold */,
48     0 /* isThreshInherited */,
49     nullptr /* appender */,
50     nullptr /* layout */,
51     0 /* additivity */
52 };
53
54 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(log, xbt, "Loggings from the logging mechanism itself");
55
56 static void xbt_log_help();
57 static void xbt_log_help_categories();
58 static void xbt_log_postexit();
59
60 void xbt_log_init(int *argc, char **argv)
61 {
62   unsigned help_requested = 0;  /* 1: logs; 2: categories */
63   int j                   = 1;
64   int parse_args          = 1; // Stop parsing the parameters once we found '--'
65
66   xbt_log_control_set("xbt_help.app:stdout xbt_help.threshold:VERBOSE xbt_help.fmt:%m%n");
67   atexit(xbt_log_postexit);
68
69   /* Set logs and init log submodule */
70   for (int i = 1; i < *argc; i++) {
71     if (strcmp("--", argv[i]) == 0) {
72       parse_args = 0;
73       argv[j++]  = argv[i]; // Keep the '--' for sg_config
74     } else if (parse_args && strncmp(argv[i], "--log=", strlen("--log=")) == 0) {
75       char* opt = strchr(argv[i], '=');
76       opt++;
77       xbt_log_control_set(opt);
78       XBT_DEBUG("Did apply '%s' as log setting", opt);
79     } else if (parse_args && strcmp(argv[i], "--help-logs") == 0) {
80       help_requested |= 1U;
81     } else if (parse_args && strcmp(argv[i], "--help-log-categories") == 0) {
82       help_requested |= 2U;
83     } else {
84       argv[j++] = argv[i];
85     }
86   }
87   if (j < *argc) {
88     argv[j] = nullptr;
89     *argc = j;
90   }
91
92   if (help_requested) {
93     if (help_requested & 1)
94       xbt_log_help();
95     if (help_requested & 2)
96       xbt_log_help_categories();
97     exit(0);
98   }
99 }
100
101 static void log_cat_exit(xbt_log_category_t cat)
102 {
103   if (cat->appender) {
104     if (cat->appender->free_)
105       cat->appender->free_(cat->appender);
106     xbt_free(cat->appender);
107     cat->appender = nullptr;
108   }
109   if (cat->layout) {
110     if (cat->layout->free_)
111       cat->layout->free_(cat->layout);
112     xbt_free(cat->layout);
113     cat->layout = nullptr;
114   }
115
116   for (auto* child = cat->firstChild; child != nullptr; child = child->nextSibling)
117     log_cat_exit(child);
118   cat->firstChild = nullptr;
119 }
120
121 static void xbt_log_postexit(void)
122 {
123   XBT_VERB("Exiting log");
124   log_cat_exit(&_XBT_LOGV(XBT_LOG_ROOT_CAT));
125 }
126
127 /* Size of the static string in which we build the log string */
128 static constexpr size_t XBT_LOG_STATIC_BUFFER_SIZE = 2048;
129 /* Minimum size of the dynamic string in which we build the log string
130    (should be greater than XBT_LOG_STATIC_BUFFER_SIZE) */
131 static constexpr size_t XBT_LOG_DYNAMIC_BUFFER_SIZE = 4096;
132
133 void _xbt_log_event_log(xbt_log_event_t ev, const char *fmt, ...)
134 {
135   const xbt_log_category_s* cat = ev->cat;
136
137   xbt_assert(ev->priority >= 0, "Negative logging priority naturally forbidden");
138   xbt_assert(static_cast<size_t>(ev->priority) < xbt_log_priority_names.size(),
139              "Priority %d is greater than the biggest allowed value", ev->priority);
140
141   while (true) {
142     if (const s_xbt_log_appender_t* appender = cat->appender) {
143       xbt_assert(cat->layout, "No valid layout for the appender of category %s", cat->name);
144
145       /* First, try with a static buffer */
146       bool done = false;
147       std::array<char, XBT_LOG_STATIC_BUFFER_SIZE> buff;
148       ev->buffer      = buff.data();
149       ev->buffer_size = buff.size();
150       va_start(ev->ap, fmt);
151       done = cat->layout->do_layout(cat->layout, ev, fmt);
152       va_end(ev->ap);
153       ev->buffer = nullptr; // Calm down, static analyzers, this pointer to local array won't leak out of the scope.
154       if (done) {
155         appender->do_append(appender, buff.data());
156       } else {
157         /* The static buffer was too small, use a dynamically expanded one */
158         ev->buffer_size = XBT_LOG_DYNAMIC_BUFFER_SIZE;
159         ev->buffer      = static_cast<char*>(xbt_malloc(ev->buffer_size));
160         while (true) {
161           va_start(ev->ap, fmt);
162           done = cat->layout->do_layout(cat->layout, ev, fmt);
163           va_end(ev->ap);
164           if (done)
165             break; /* Got it */
166           ev->buffer_size *= 2;
167           ev->buffer = static_cast<char*>(xbt_realloc(ev->buffer, ev->buffer_size));
168         }
169         appender->do_append(appender, ev->buffer);
170         xbt_free(ev->buffer);
171       }
172     }
173
174     if (not cat->additivity)
175       break;
176     cat = cat->parent;
177   }
178 }
179
180 /* NOTE:
181  *
182  * The standard logging macros use _XBT_LOG_ISENABLED, which calls _xbt_log_cat_init().  Thus, if we want to avoid an
183  * infinite recursion, we can not use the standard logging macros in _xbt_log_cat_init(), and in all functions called
184  * from it.
185  *
186  * To circumvent the problem, we define the macro DISABLE_XBT_LOG_CAT_INIT() to hide the real _xbt_log_cat_init(). The
187  * macro has to be called at the beginning of the affected functions.
188  */
189 static int fake_xbt_log_cat_init(xbt_log_category_t, e_xbt_log_priority_t)
190 {
191   return 0;
192 }
193 #define DISABLE_XBT_LOG_CAT_INIT()                                                                                     \
194  XBT_ATTRIB_UNUSED int (*_xbt_log_cat_init)(xbt_log_category_t, e_xbt_log_priority_t) = fake_xbt_log_cat_init
195
196 static void _xbt_log_cat_apply_set(xbt_log_category_t category, const xbt_log_setting_t& setting)
197 {
198   DISABLE_XBT_LOG_CAT_INIT();
199   if (setting.thresh != xbt_log_priority_uninitialized) {
200     xbt_log_threshold_set(category, setting.thresh);
201
202     XBT_DEBUG("Apply settings for category '%s': set threshold to %s (=%d)",
203            category->name, xbt_log_priority_names[category->threshold], category->threshold);
204   }
205
206   if (not setting.fmt.empty()) {
207     xbt_log_layout_set(category, xbt_log_layout_format_new(setting.fmt.c_str()));
208
209     XBT_DEBUG("Apply settings for category '%s': set format to %s", category->name, setting.fmt.c_str());
210   }
211
212   if (setting.additivity != -1) {
213     xbt_log_additivity_set(category, setting.additivity);
214
215     XBT_DEBUG("Apply settings for category '%s': set additivity to %s", category->name,
216               (setting.additivity ? "on" : "off"));
217   }
218   if (setting.appender) {
219     xbt_log_appender_set(category, setting.appender);
220     if (not category->layout)
221       xbt_log_layout_set(category, xbt_log_layout_simple_new(nullptr));
222     category->additivity = 0;
223     XBT_DEBUG("Set %p as appender of category '%s'", setting.appender, category->name);
224   }
225 }
226
227 /*
228  * This gets called the first time a category is referenced and performs the initialization.
229  * Also resets threshold to inherited!
230  */
231 int _xbt_log_cat_init(xbt_log_category_t category, e_xbt_log_priority_t priority)
232 {
233   DISABLE_XBT_LOG_CAT_INIT();
234   if (category->initialized)
235     return priority >= category->threshold;
236
237   static std::recursive_mutex log_cat_init_mutex;
238   log_cat_init_mutex.lock();
239
240   XBT_DEBUG("Initializing category '%s' (firstChild=%s, nextSibling=%s)", category->name,
241          (category->firstChild ? category->firstChild->name : "none"),
242          (category->nextSibling ? category->nextSibling->name : "none"));
243
244   if (category == &_XBT_LOGV(XBT_LOG_ROOT_CAT)) {
245     category->threshold = xbt_log_priority_info;
246     category->appender  = xbt_log_appender_stream(stderr);
247     category->layout    = xbt_log_layout_simple_new(nullptr);
248   } else {
249     if (not category->parent)
250       category->parent = &_XBT_LOGV(XBT_LOG_ROOT_CAT);
251
252     XBT_DEBUG("Set %s (%s) as father of %s ", category->parent->name,
253            (category->parent->initialized ? xbt_log_priority_names[category->parent->threshold] : "uninited"),
254            category->name);
255     xbt_log_parent_set(category, category->parent);
256
257     if (XBT_LOG_ISENABLED(log, xbt_log_priority_debug)) {
258       std::string res;
259       const xbt_log_category_s* cpp = category->parent->firstChild;
260       while (cpp) {
261         res += std::string(" ") + cpp->name;
262         cpp = cpp->nextSibling;
263       }
264
265       XBT_DEBUG("Children of %s:%s; nextSibling: %s", category->parent->name, res.c_str(),
266                 (category->parent->nextSibling ? category->parent->nextSibling->name : "none"));
267     }
268   }
269
270   /* Apply the control */
271   if (auto iset = std::find_if(begin(xbt_log_settings()), end(xbt_log_settings()),
272                                [category](const xbt_log_setting_t& s) { return s.catname == category->name; });
273       iset != xbt_log_settings().end()) {
274     _xbt_log_cat_apply_set(category, *iset);
275     xbt_log_settings().erase(iset);
276   } else {
277     XBT_DEBUG("Category '%s': inherited threshold = %s (=%d)", category->name,
278               xbt_log_priority_names[category->threshold], category->threshold);
279   }
280
281   category->initialized = 1;
282   log_cat_init_mutex.unlock();
283   return priority >= category->threshold;
284 }
285
286 void xbt_log_parent_set(xbt_log_category_t cat, xbt_log_category_t parent)
287 {
288   xbt_assert(cat, "NULL category to be given a parent");
289   xbt_assert(parent, "The parent category of %s is NULL", cat->name);
290
291   /* if the category is initialized, unlink from current parent */
292   if (cat->initialized) {
293     xbt_log_category_t *cpp = &cat->parent->firstChild;
294
295     while (*cpp != cat && *cpp != nullptr) {
296       cpp = &(*cpp)->nextSibling;
297     }
298
299     xbt_assert(*cpp == cat);
300     *cpp = cat->nextSibling;
301   }
302
303   cat->parent = parent;
304   cat->nextSibling = parent->firstChild;
305
306   parent->firstChild = cat;
307
308   if (not parent->initialized)
309     (void)_xbt_log_cat_init(parent, xbt_log_priority_uninitialized /* ignored */);
310
311   cat->threshold = parent->threshold;
312
313   cat->isThreshInherited = 1;
314 }
315
316 static void _set_inherited_thresholds(const s_xbt_log_category_t* cat)
317 {
318   xbt_log_category_t child = cat->firstChild;
319
320   for (; child != nullptr; child = child->nextSibling) {
321     if (child->isThreshInherited) {
322       if (cat != &_XBT_LOGV(log))
323         XBT_VERB("Set category threshold of %s to %s (=%d)",
324               child->name, xbt_log_priority_names[cat->threshold], cat->threshold);
325       child->threshold = cat->threshold;
326       _set_inherited_thresholds(child);
327     }
328   }
329 }
330
331 void xbt_log_threshold_set(xbt_log_category_t cat, e_xbt_log_priority_t threshold)
332 {
333   cat->threshold = threshold;
334   cat->isThreshInherited = 0;
335
336   _set_inherited_thresholds(cat);
337 }
338
339 static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string)
340 {
341   const char *orig_control_string = control_string;
342   xbt_log_setting_t set;
343
344   if (not*control_string)
345     return set;
346   XBT_DEBUG("Parse log setting '%s'", control_string);
347
348   control_string += strspn(control_string, " ");
349   const char* name = control_string;
350   control_string += strcspn(control_string, ".:= ");
351   const char* option = control_string;
352   control_string += strcspn(control_string, ":= ");
353   const char* value = control_string;
354
355   xbt_assert(*option == '.' && (*value == '=' || *value == ':'), "Invalid control string '%s'", orig_control_string);
356
357   size_t name_len = option - name;
358   ++option;
359   size_t option_len = value - option;
360   ++value;
361
362   if (strncmp(option, "threshold", option_len) == 0) {
363     XBT_DEBUG("New priority name = %s", value);
364     int i;
365     for (i = 0; i < xbt_log_priority_infinite; i++) {
366       if (strcasecmp(value, xbt_log_priority_names[i]) == 0) {
367         XBT_DEBUG("This is priority %d", i);
368         break;
369       }
370     }
371
372     if(i<XBT_LOG_STATIC_THRESHOLD){
373       fprintf(stderr, "Priority '%s' (in setting '%s') is above allowed priority '%s'.\n\n"
374                       "Compiling SimGrid with -DNDEBUG forbids the levels 'trace' and 'debug'\n"
375                       "while -DNLOG forbids any logging, at any level.",
376               value, name, xbt_log_priority_names[XBT_LOG_STATIC_THRESHOLD]);
377       exit(1);
378     }else if (i < xbt_log_priority_infinite) {
379       set.thresh = (e_xbt_log_priority_t)i;
380     } else {
381       throw std::invalid_argument(simgrid::xbt::string_printf(
382           "Unknown priority name: %s (must be one of: trace,debug,verbose,info,warning,error,critical)", value));
383     }
384   } else if (strncmp(option, "additivity", option_len) == 0) {
385     set.additivity = (strcasecmp(value, "ON") == 0 || strcasecmp(value, "YES") == 0 || strcmp(value, "1") == 0);
386   } else if (strncmp(option, "appender", option_len) == 0) {
387     if (strncmp(value, "file:", 5) == 0) {
388       set.appender = xbt_log_appender_file_new(value + 5);
389     } else if (strncmp(value, "rollfile:", 9) == 0) {
390       set.appender = xbt_log_appender2_file_new(value + 9, 1);
391     } else if (strncmp(value, "splitfile:", 10) == 0) {
392       set.appender = xbt_log_appender2_file_new(value + 10, 0);
393     } else if (strcmp(value, "stderr") == 0) {
394       set.appender = xbt_log_appender_stream(stderr);
395     } else if (strcmp(value, "stdout") == 0) {
396       set.appender = xbt_log_appender_stream(stdout);
397     } else {
398       throw std::invalid_argument(simgrid::xbt::string_printf("Unknown appender log type: '%s'", value));
399     }
400   } else if (strncmp(option, "fmt", option_len) == 0) {
401     set.fmt = value;
402   } else {
403     xbt_die("Unknown setting of the log category: '%.*s'", static_cast<int>(option_len), option);
404   }
405   set.catname = std::string(name, name_len);
406
407   XBT_DEBUG("This is for cat '%s'", set.catname.c_str());
408
409   return set;
410 }
411
412 static xbt_log_category_t _xbt_log_cat_searchsub(xbt_log_category_t cat, const char* name)
413 {
414   XBT_DEBUG("Search '%s' into '%s' (firstChild='%s'; nextSibling='%s')", name,
415          cat->name, (cat->firstChild ? cat->firstChild->name : "none"),
416          (cat->nextSibling ? cat->nextSibling->name : "none"));
417   if (strcmp(cat->name, name) == 0)
418     return cat;
419
420   for (xbt_log_category_t child = cat->firstChild; child != nullptr; child = child->nextSibling) {
421     XBT_DEBUG("Dig into %s", child->name);
422     xbt_log_category_t res = _xbt_log_cat_searchsub(child, name);
423     if (res)
424       return res;
425   }
426
427   return nullptr;
428 }
429
430 void xbt_log_control_set(const char *control_string)
431 {
432   if (not control_string)
433     return;
434   XBT_DEBUG("Parse log settings '%s'", control_string);
435
436   /* Special handling of no_loc request, which asks for any file localization to be omitted (for tesh runs) */
437   if (strcmp(control_string, "no_loc") == 0) {
438     xbt_log_no_loc = 1;
439     return;
440   }
441   /* Split the string, and remove empty entries
442      Parse each entry and either use it right now (if the category was already created), or store it for further use */
443   std::string parsed_control_string(control_string);
444   boost::escaped_list_separator<char> sep("\\", " ", "\"'");
445   boost::tokenizer<boost::escaped_list_separator<char>> tok(parsed_control_string, sep);
446   for (const auto& str : tok) {
447     if (str.empty())
448       continue;
449
450     xbt_log_setting_t set  = _xbt_log_parse_setting(str.c_str());
451     xbt_log_category_t cat = _xbt_log_cat_searchsub(&_XBT_LOGV(XBT_LOG_ROOT_CAT), set.catname.c_str());
452
453     if (cat) {
454       XBT_DEBUG("Apply directly");
455       _xbt_log_cat_apply_set(cat, set);
456     } else {
457       XBT_DEBUG("Store for further application");
458       XBT_DEBUG("push %p to the settings", &set);
459       xbt_log_settings().emplace_back(std::move(set));
460     }
461   }
462 }
463
464 void xbt_log_appender_set(xbt_log_category_t cat, xbt_log_appender_t app)
465 {
466   if (cat->appender) {
467     if (cat->appender->free_)
468       cat->appender->free_(cat->appender);
469     xbt_free(cat->appender);
470   }
471   cat->appender = app;
472 }
473
474 void xbt_log_layout_set(xbt_log_category_t cat, xbt_log_layout_t lay)
475 {
476   DISABLE_XBT_LOG_CAT_INIT();
477   if (not cat->appender) {
478     XBT_VERB ("No appender to category %s. Setting the file appender as default", cat->name);
479     xbt_log_appender_set(cat, xbt_log_appender_file_new(nullptr));
480   }
481   if (cat->layout) {
482     if (cat->layout->free_) {
483       cat->layout->free_(cat->layout);
484     }
485     xbt_free(cat->layout);
486   }
487   cat->layout = lay;
488   xbt_log_additivity_set(cat, 0);
489 }
490
491 void xbt_log_additivity_set(xbt_log_category_t cat, int additivity)
492 {
493   cat->additivity = additivity;
494 }
495
496 static void xbt_log_help()
497 {
498   XBT_HELP(
499       "Description of the logging output:\n"
500       "\n"
501       "   Threshold configuration: --log=CATEGORY_NAME.thres:PRIORITY_LEVEL\n"
502       "      CATEGORY_NAME: defined in code with function 'XBT_LOG_NEW_CATEGORY'\n"
503       "      PRIORITY_LEVEL: the level to print (trace,debug,verbose,info,warning,error,critical)\n"
504       "         -> trace: enter and return of some functions\n"
505       "         -> debug: crufty output\n"
506       "         -> verbose: verbose output for the user wanting more\n"
507       "         -> info: output about the regular functioning\n"
508       "         -> warning: minor issue encountered\n"
509       "         -> error: issue encountered\n"
510       "         -> critical: major issue encountered\n"
511       "      The default priority level is 'info'.\n"
512       "\n"
513       "   Format configuration: --log=CATEGORY_NAME.fmt:FORMAT\n"
514       "      FORMAT string may contain:\n"
515       "         -> %%%%: the %% char\n"
516       "         -> %%n: platform-dependent line separator (LOG4J compatible)\n"
517       "         -> %%e: plain old space (SimGrid extension)\n"
518       "\n"
519       "         -> %%m: user-provided message\n"
520       "\n"
521       "         -> %%c: Category name (LOG4J compatible)\n"
522       "         -> %%p: Priority name (LOG4J compatible)\n"
523       "\n"
524       "         -> %%h: Hostname (SimGrid extension)\n"
525       "         -> %%a: Actor name (SimGrid extension)\n"
526       "         -> %%t: Thread \"name\" (LOG4J compatible -- actually the address of the thread in memory)\n"
527       "         -> %%i: Process PID (SimGrid extension -- this is a 'i' as in 'i'dea)\n"
528       "\n"
529       "         -> %%F: file name where the log event was raised (LOG4J compatible)\n"
530       "         -> %%l: location where the log event was raised (LOG4J compatible, like '%%F:%%L' -- this is a l as "
531       "in 'l'etter)\n"
532       "         -> %%L: line number where the log event was raised (LOG4J compatible)\n"
533       "         -> %%M: function name (LOG4J compatible -- called method name here of course).\n"
534       "\n"
535       "         -> %%b: full backtrace (Called %%throwable in LOG4J). Defined only when using the GNU libc because\n"
536       "                 backtrace() is not defined elsewhere.\n"
537       "         -> %%B: short backtrace (only the first line of the %%b). Called %%throwable{short} in LOG4J; "
538       "defined where %%b is.\n"
539       "\n"
540       "         -> %%d: date (UNIX-like epoch)\n"
541       "         -> %%r: application age (time elapsed since the beginning of the application)\n"
542       "\n"
543       "   Category appender: --log=CATEGORY_NAME.app:APPENDER\n"
544       "      APPENDER may be:\n"
545       "         -> stdout or stderr: standard output streams\n"
546       "         -> file:NAME: append to file with given name\n"
547       "         -> splitfile:SIZE:NAME: append to files with maximum size SIZE per file.\n"
548       "                                 NAME may contain the %% wildcard as a placeholder for the file number.\n"
549       "         -> rollfile:SIZE:NAME: append to file with maximum size SIZE.\n"
550       "\n"
551       "   Category additivity: --log=CATEGORY_NAME.add:VALUE\n"
552       "      VALUE:  '0', '1', 'no', 'yes', 'on', or 'off'\n"
553       "\n"
554       "   Miscellaneous:\n"
555       "      --help-log-categories    Display the current hierarchy of log categories.\n"
556       "      --log=no_loc             Don't print file names in messages (for tesh tests).\n");
557 }
558
559 static void xbt_log_help_categories_rec(xbt_log_category_t category, const std::string& prefix)
560 {
561   if (not category)
562     return;
563
564   std::string this_prefix(prefix);
565   std::string child_prefix(prefix);
566   if (category->parent) {
567     this_prefix  += " \\_ ";
568     child_prefix += " |  ";
569   }
570
571   std::vector<xbt_log_category_t> cats;
572   for (xbt_log_category_t cat = category; cat != nullptr; cat = cat->nextSibling)
573     cats.push_back(cat);
574
575   std::sort(begin(cats), end(cats),
576             [](const s_xbt_log_category_t* a, const s_xbt_log_category_t* b) { return strcmp(a->name, b->name) < 0; });
577
578   for (auto const& cat : cats) {
579     XBT_HELP("%s%s: %s", this_prefix.c_str(), cat->name, cat->description);
580     if (cat == cats.back() && category->parent)
581       child_prefix[child_prefix.rfind('|')] = ' ';
582     xbt_log_help_categories_rec(cat->firstChild, child_prefix);
583   }
584 }
585
586 static void xbt_log_help_categories()
587 {
588   XBT_HELP("Current log category hierarchy:");
589   xbt_log_help_categories_rec(&_XBT_LOGV(XBT_LOG_ROOT_CAT), "   ");
590   XBT_HELP("%s", "");
591 }