X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/58205532bf7d35bd624c204dd814916b8e8b2fea..7ca53b5ebe9b96f24832b6890a34e13599b254c2:/src/xbt/log.cpp diff --git a/src/xbt/log.cpp b/src/xbt/log.cpp index 6be9068198..fd8afa045b 100644 --- a/src/xbt/log.cpp +++ b/src/xbt/log.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include int xbt_log_no_loc = 0; /* if set to true (with --log=no_loc), file localization will be omitted (for tesh tests) */ @@ -247,6 +248,16 @@ static void _xbt_log_cat_apply_set(xbt_log_category_t category, const xbt_log_se } } +/** Asserts that the provided name is unique */ +void _xbt_log_is_name_unique(const char* name, const char* file, int line) +{ + static std::unordered_set used_names; + + if (used_names.find(name) != used_names.end()) + XBT_WARN("%s:%d: log category redefined: %s", file, line, name); + used_names.insert(std::string(name)); +} + /* * This gets called the first time a category is referenced and performs the initialization. * Also resets threshold to inherited! @@ -254,6 +265,7 @@ static void _xbt_log_cat_apply_set(xbt_log_category_t category, const xbt_log_se int _xbt_log_cat_init(xbt_log_category_t category, e_xbt_log_priority_t priority) { DISABLE_XBT_LOG_CAT_INIT(); + if (category->initialized) return priority >= category->threshold;