Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Define variadic logging macros.
authoragiersch <agiersch@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 17 Feb 2011 16:11:14 +0000 (16:11 +0000)
committeragiersch <agiersch@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 17 Feb 2011 16:11:14 +0000 (16:11 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9652 48e7efb5-ca39-0410-a469-dd3cf9ba447f

ChangeLog
doc/FAQ.doc
doc/gtut-files/06-logs.c
doc/gtut-files/07-timers.c
doc/gtut-files/08-exceptions.c
doc/gtut-files/09-simpledata.c
doc/gtut-files/10-rpc.c
doc/gtut-files/11-explicitwait.c
doc/gtut-tour-06-logs.doc
include/xbt/log.h
src/xbt/log.c

index 19700f0..1f34085 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -34,6 +34,7 @@ SimGrid (3.6) unstable; urgency=low
    NULL-terminated array. This may solve backward compatibility issues
    due to the change to return type of SD_Simulate. See also:
    http://lists.gforge.inria.fr/pipermail/simgrid-user/2010-December/002206.html
    NULL-terminated array. This may solve backward compatibility issues
    due to the change to return type of SD_Simulate. See also:
    http://lists.gforge.inria.fr/pipermail/simgrid-user/2010-December/002206.html
+ * Add new logging macros, with variable number of arguments.
 
  INSTR
  * New configuration options
 
  INSTR
  * New configuration options
index e076825..d74e882 100644 (file)
@@ -923,7 +923,7 @@ int sender()
                                   calloc(1,sizeof(double)));
   *((double*) task->data) = MSG_get_clock();
   MSG_task_put(task, slaves[i % slaves_count], PORT_22);
                                   calloc(1,sizeof(double)));
   *((double*) task->data) = MSG_get_clock();
   MSG_task_put(task, slaves[i % slaves_count], PORT_22);
-  INFO0("Send completed");
+  XBT_INFO("Send completed");
   return 0;
 }
 int receiver()
   return 0;
 }
 int receiver()
@@ -936,7 +936,7 @@ int receiver()
   time2 = MSG_get_clock();
   if(time1<*((double *)task->data))
      time1 = *((double *) task->data);
   time2 = MSG_get_clock();
   if(time1<*((double *)task->data))
      time1 = *((double *) task->data);
-  INFO1("Communication time :  \"%f\" ", time2-time1);
+  XBT_INFO("Communication time :  \"%f\" ", time2-time1);
   free(task->data);
   MSG_task_destroy(task);
   return 0;
   free(task->data);
   MSG_task_destroy(task);
   return 0;
index 9ab0443..6de6602 100644 (file)
@@ -18,7 +18,7 @@ int server_kill_cb(gras_msg_cb_ctx_t ctx, void *payload)
   gras_socket_t client = gras_msg_cb_ctx_from(ctx);
   server_data_t *globals = (server_data_t *) gras_userdata_get();
 
   gras_socket_t client = gras_msg_cb_ctx_from(ctx);
   server_data_t *globals = (server_data_t *) gras_userdata_get();
 
-  CRITICAL2("Argh, killed by %s:%d! Bye folks...",
+  XBT_CRITICAL("Argh, killed by %s:%d! Bye folks...",
             gras_socket_peer_name(client), gras_socket_peer_port(client));
 
   globals->killed = 1;
             gras_socket_peer_name(client), gras_socket_peer_port(client));
 
   globals->killed = 1;
@@ -30,7 +30,7 @@ int server_hello_cb(gras_msg_cb_ctx_t ctx, void *payload)
 {
   gras_socket_t client = gras_msg_cb_ctx_from(ctx);
 
 {
   gras_socket_t client = gras_msg_cb_ctx_from(ctx);
 
-  INFO2("Cool, we received the message from %s:%d.",
+  XBT_INFO("Cool, we received the message from %s:%d.",
         gras_socket_peer_name(client), gras_socket_peer_port(client));
 
   return 0;
         gras_socket_peer_name(client), gras_socket_peer_port(client));
 
   return 0;
@@ -72,17 +72,17 @@ int client(int argc, char *argv[])
   gras_msgtype_declare("kill", NULL);
   mysock = gras_socket_server_range(1024, 10000, 0, 0);
 
   gras_msgtype_declare("kill", NULL);
   mysock = gras_socket_server_range(1024, 10000, 0, 0);
 
-  VERB1("Client ready; listening on %d", gras_socket_my_port(mysock));
+  XBT_VERB("Client ready; listening on %d", gras_socket_my_port(mysock));
 
   gras_os_sleep(1.5);           /* sleep 1 second and half */
   toserver = gras_socket_client(argv[1], atoi(argv[2]));
 
   gras_msg_send(toserver, "hello", NULL);
 
   gras_os_sleep(1.5);           /* sleep 1 second and half */
   toserver = gras_socket_client(argv[1], atoi(argv[2]));
 
   gras_msg_send(toserver, "hello", NULL);
-  INFO1("we sent the data to the server on %s. Let's do it again for fun",
+  XBT_INFO("we sent the data to the server on %s. Let's do it again for fun",
         gras_socket_peer_name(toserver));
   gras_msg_send(toserver, "hello", NULL);
 
         gras_socket_peer_name(toserver));
   gras_msg_send(toserver, "hello", NULL);
 
-  INFO0("Ok. Enough. Have a rest, and then kill the server");
+  XBT_INFO("Ok. Enough. Have a rest, and then kill the server");
   gras_os_sleep(5);             /* sleep 1 second and half */
   gras_msg_send(toserver, "kill", NULL);
 
   gras_os_sleep(5);             /* sleep 1 second and half */
   gras_msg_send(toserver, "kill", NULL);
 
index 6ddb67d..202f76c 100644 (file)
@@ -18,7 +18,7 @@ int server_kill_cb(gras_msg_cb_ctx_t ctx, void *payload)
   gras_socket_t client = gras_msg_cb_ctx_from(ctx);
   server_data_t *globals = (server_data_t *) gras_userdata_get();
 
   gras_socket_t client = gras_msg_cb_ctx_from(ctx);
   server_data_t *globals = (server_data_t *) gras_userdata_get();
 
-  CRITICAL2("Argh, killed by %s:%d! Bye folks...",
+  XBT_CRITICAL("Argh, killed by %s:%d! Bye folks...",
             gras_socket_peer_name(client), gras_socket_peer_port(client));
 
   globals->killed = 1;
             gras_socket_peer_name(client), gras_socket_peer_port(client));
 
   globals->killed = 1;
@@ -30,7 +30,7 @@ int server_hello_cb(gras_msg_cb_ctx_t ctx, void *payload)
 {
   gras_socket_t client = gras_msg_cb_ctx_from(ctx);
 
 {
   gras_socket_t client = gras_msg_cb_ctx_from(ctx);
 
-  INFO2("Cool, we received the message from %s:%d.",
+  XBT_INFO("Cool, we received the message from %s:%d.",
         gras_socket_peer_name(client), gras_socket_peer_port(client));
 
   return 0;
         gras_socket_peer_name(client), gras_socket_peer_port(client));
 
   return 0;
@@ -74,7 +74,7 @@ void client_do_hello(void)
   client_data_t *globals = (client_data_t *) gras_userdata_get();
 
   gras_msg_send(globals->toserver, "hello", NULL);
   client_data_t *globals = (client_data_t *) gras_userdata_get();
 
   gras_msg_send(globals->toserver, "hello", NULL);
-  INFO0("Hello sent to server");
+  XBT_INFO("Hello sent to server");
 }                               /* end_of_client_do_hello */
 
 void client_do_stop(void)
 }                               /* end_of_client_do_hello */
 
 void client_do_stop(void)
@@ -82,12 +82,12 @@ void client_do_stop(void)
   client_data_t *globals = (client_data_t *) gras_userdata_get();
 
   gras_msg_send(globals->toserver, "kill", NULL);
   client_data_t *globals = (client_data_t *) gras_userdata_get();
 
   gras_msg_send(globals->toserver, "kill", NULL);
-  INFO0("Kill sent to server");
+  XBT_INFO("Kill sent to server");
 
   gras_timer_cancel_repeat(0.5, client_do_hello);
 
   globals->done = 1;
 
   gras_timer_cancel_repeat(0.5, client_do_hello);
 
   globals->done = 1;
-  INFO0("Break the client's while loop");
+  XBT_INFO("Break the client's while loop");
 }                               /* end_of_client_do_stop */
 
 int client(int argc, char *argv[])
 }                               /* end_of_client_do_stop */
 
 int client(int argc, char *argv[])
@@ -101,7 +101,7 @@ int client(int argc, char *argv[])
   gras_msgtype_declare("kill", NULL);
   mysock = gras_socket_server_range(1024, 10000, 0, 0);
 
   gras_msgtype_declare("kill", NULL);
   mysock = gras_socket_server_range(1024, 10000, 0, 0);
 
-  VERB1("Client ready; listening on %d", gras_socket_my_port(mysock));
+  XBT_VERB("Client ready; listening on %d", gras_socket_my_port(mysock));
 
   globals = gras_userdata_new(client_data_t *);
   globals->done = 0;
 
   globals = gras_userdata_new(client_data_t *);
   globals->done = 0;
@@ -109,10 +109,10 @@ int client(int argc, char *argv[])
   gras_os_sleep(1.5);           /* sleep 1 second and half */
   globals->toserver = gras_socket_client(argv[1], atoi(argv[2]));
 
   gras_os_sleep(1.5);           /* sleep 1 second and half */
   globals->toserver = gras_socket_client(argv[1], atoi(argv[2]));
 
-  INFO0("Programming the repetitive action with a frequency of 0.5 sec");
+  XBT_INFO("Programming the repetitive action with a frequency of 0.5 sec");
   gras_timer_repeat(0.5, client_do_hello);
 
   gras_timer_repeat(0.5, client_do_hello);
 
-  INFO0("Programming the delayed action in 5 secs");
+  XBT_INFO("Programming the delayed action in 5 secs");
   gras_timer_delay(5, client_do_stop);
 
   while (!globals->done) {
   gras_timer_delay(5, client_do_stop);
 
   while (!globals->done) {
index 19d663e..3f1c075 100644 (file)
@@ -18,7 +18,7 @@ int server_kill_cb(gras_msg_cb_ctx_t ctx, void *payload)
   gras_socket_t client = gras_msg_cb_ctx_from(ctx);
   server_data_t *globals = (server_data_t *) gras_userdata_get();
 
   gras_socket_t client = gras_msg_cb_ctx_from(ctx);
   server_data_t *globals = (server_data_t *) gras_userdata_get();
 
-  CRITICAL2("Argh, killed by %s:%d! Bye folks, I'm out of here...",
+  XBT_CRITICAL("Argh, killed by %s:%d! Bye folks, I'm out of here...",
             gras_socket_peer_name(client), gras_socket_peer_port(client));
 
   globals->killed = 1;
             gras_socket_peer_name(client), gras_socket_peer_port(client));
 
   globals->killed = 1;
@@ -41,10 +41,10 @@ int server(int argc, char *argv[])
 
   if (argc > 1 && !strcmp(argv[1], "--cheat")) {
     mysock = gras_socket_server(9999);
 
   if (argc > 1 && !strcmp(argv[1], "--cheat")) {
     mysock = gras_socket_server(9999);
-    INFO0("Hi! hi! I'm not in the search range, but in 9999...");
+    XBT_INFO("Hi! hi! I'm not in the search range, but in 9999...");
   } else {
     mysock = gras_socket_server((rand() % 10) + 3000);
   } else {
     mysock = gras_socket_server((rand() % 10) + 3000);
-    INFO1("Ok, I'm hidden on port %d. Hope for the best.",
+    XBT_INFO("Ok, I'm hidden on port %d. Hope for the best.",
           gras_socket_my_port(mysock));
   }
 
           gras_socket_my_port(mysock));
   }
 
@@ -69,7 +69,7 @@ int client(int argc, char *argv[])
   gras_msgtype_declare("kill", NULL);
   mysock = gras_socket_server_range(1024, 10000, 0, 0);
 
   gras_msgtype_declare("kill", NULL);
   mysock = gras_socket_server_range(1024, 10000, 0, 0);
 
-  VERB0("Run little server, run. I'll get you. (sleep 1.5 sec)");
+  XBT_VERB("Run little server, run. I'll get you. (sleep 1.5 sec)");
   gras_os_sleep(1.5);
 
   for (port = 3000, found = 0; port < 3010 && !found; port++) {
   gras_os_sleep(1.5);
 
   for (port = 3000, found = 0; port < 3010 && !found; port++) {
@@ -78,14 +78,14 @@ int client(int argc, char *argv[])
       gras_msg_send(toserver, "kill", NULL);
       gras_socket_close(toserver);
       found = 1;
       gras_msg_send(toserver, "kill", NULL);
       gras_socket_close(toserver);
       found = 1;
-      INFO1("Yeah! I found the server on %d! It's eradicated by now.",
+      XBT_INFO("Yeah! I found the server on %d! It's eradicated by now.",
             port);
     }
     CATCH(e) {
       xbt_ex_free(e);
     }
     if (!found)
             port);
     }
     CATCH(e) {
       xbt_ex_free(e);
     }
     if (!found)
-      INFO1("Damn, the server is not on %d", port);
+      XBT_INFO("Damn, the server is not on %d", port);
   }                             /* end_of_loop */
 
   if (!found)
   }                             /* end_of_loop */
 
   if (!found)
index a170ee4..29c24c0 100644 (file)
@@ -19,11 +19,11 @@ int server_kill_cb(gras_msg_cb_ctx_t ctx, void *payload)
   gras_socket_t client = gras_msg_cb_ctx_from(ctx);
   server_data_t *globals = (server_data_t *) gras_userdata_get();
 
   gras_socket_t client = gras_msg_cb_ctx_from(ctx);
   server_data_t *globals = (server_data_t *) gras_userdata_get();
 
-  CRITICAL3("Argh, %s:%d gave me %.2f seconds before suicide!",
+  XBT_CRITICAL("Argh, %s:%d gave me %.2f seconds before suicide!",
             gras_socket_peer_name(client), gras_socket_peer_port(client),
             delay);
   gras_os_sleep(delay);
             gras_socket_peer_name(client), gras_socket_peer_port(client),
             delay);
   gras_os_sleep(delay);
-  CRITICAL0("Bye folks...");
+  XBT_CRITICAL("Bye folks...");
 
 
   globals->killed = 1;
 
 
   globals->killed = 1;
@@ -36,7 +36,7 @@ int server_hello_cb(gras_msg_cb_ctx_t ctx, void *payload)
   char *msg = *(char **) payload;
   gras_socket_t client = gras_msg_cb_ctx_from(ctx);
 
   char *msg = *(char **) payload;
   gras_socket_t client = gras_msg_cb_ctx_from(ctx);
 
-  INFO3("Cool, we received a message from %s:%d. Here it is: \"%s\"",
+  XBT_INFO("Cool, we received a message from %s:%d. Here it is: \"%s\"",
         gras_socket_peer_name(client), gras_socket_peer_port(client), msg);
 
   return 0;
         gras_socket_peer_name(client), gras_socket_peer_port(client), msg);
 
   return 0;
@@ -83,19 +83,19 @@ int client(int argc, char *argv[])
   message_declaration();
   mysock = gras_socket_server_range(1024, 10000, 0, 0);
 
   message_declaration();
   mysock = gras_socket_server_range(1024, 10000, 0, 0);
 
-  VERB1("Client ready; listening on %d", gras_socket_my_port(mysock));
+  XBT_VERB("Client ready; listening on %d", gras_socket_my_port(mysock));
 
   gras_os_sleep(1.5);           /* sleep 1 second and half */
   toserver = gras_socket_client(argv[1], atoi(argv[2]));
 
   char *hello_payload = "Nice to meet you";
   gras_msg_send(toserver, "hello", &hello_payload);
 
   gras_os_sleep(1.5);           /* sleep 1 second and half */
   toserver = gras_socket_client(argv[1], atoi(argv[2]));
 
   char *hello_payload = "Nice to meet you";
   gras_msg_send(toserver, "hello", &hello_payload);
-  INFO1("we sent the hello to the server on %s.",
+  XBT_INFO("we sent the hello to the server on %s.",
         gras_socket_peer_name(toserver));
 
   double kill_payload = 0.5;
   gras_msg_send(toserver, "kill", &kill_payload);
         gras_socket_peer_name(toserver));
 
   double kill_payload = 0.5;
   gras_msg_send(toserver, "kill", &kill_payload);
-  INFO0("Gave the server more 0.5 second to live");
+  XBT_INFO("Gave the server more 0.5 second to live");
 
   gras_exit();
   return 0;
 
   gras_exit();
   return 0;
index 9cc423a..f00a06f 100644 (file)
@@ -16,7 +16,7 @@ int server_done_cb(gras_msg_cb_ctx_t ctx, void *payload)
 {
   server_data_t *globals = (server_data_t *) gras_userdata_get();
   globals->done = 1;
 {
   server_data_t *globals = (server_data_t *) gras_userdata_get();
   globals->done = 1;
-  INFO0("Server done");
+  XBT_INFO("Server done");
 
   return 0;
 }                               /* end_of_done_callback */
 
   return 0;
 }                               /* end_of_done_callback */
@@ -38,9 +38,9 @@ int server_convert_i2a_cb(gras_msg_cb_ctx_t ctx, void *payload)
   char *result;
   char *p;
 
   char *result;
   char *p;
 
-  INFO1("Convert %ld to string", data);
+  XBT_INFO("Convert %ld to string", data);
   result = bprintf("%ld", data);
   result = bprintf("%ld", data);
-  INFO2("%ld converted to string: %s", data, result);
+  XBT_INFO("%ld converted to string: %s", data, result);
 
   gras_msg_rpcreturn(60, ctx, &result);
   free(result);
 
   gras_msg_rpcreturn(60, ctx, &result);
   free(result);
@@ -53,7 +53,7 @@ int server_convert_a2i_cb(gras_msg_cb_ctx_t ctx, void *payload)
   long result;
   char *p;
 
   long result;
   char *p;
 
-  INFO1("Convert %s to long", string);
+  XBT_INFO("Convert %s to long", string);
   result = strtol(string, &p, 10);
 
   if (*p != '\0')
   result = strtol(string, &p, 10);
 
   if (*p != '\0')
@@ -101,26 +101,26 @@ int client(int argc, char *argv[])
   message_declaration();
   mysock = gras_socket_server_range(1024, 10000, 0, 0);
 
   message_declaration();
   mysock = gras_socket_server_range(1024, 10000, 0, 0);
 
-  VERB1("Client ready; listening on %d", gras_socket_my_port(mysock));
+  XBT_VERB("Client ready; listening on %d", gras_socket_my_port(mysock));
 
   gras_os_sleep(1.5);           /* sleep 1 second and half */
   toserver = gras_socket_client(argv[1], atoi(argv[2]));
 
   long long_to_convert = 4321;
   char *string_result;
 
   gras_os_sleep(1.5);           /* sleep 1 second and half */
   toserver = gras_socket_client(argv[1], atoi(argv[2]));
 
   long long_to_convert = 4321;
   char *string_result;
-  INFO1("Ask to convert %ld", long_to_convert);
+  XBT_INFO("Ask to convert %ld", long_to_convert);
   gras_msg_rpccall(toserver, 60, "convert i2a", &long_to_convert,
                    &string_result);
   gras_msg_rpccall(toserver, 60, "convert i2a", &long_to_convert,
                    &string_result);
-  INFO2("The server says that %ld is equal to \"%s\".", long_to_convert,
+  XBT_INFO("The server says that %ld is equal to \"%s\".", long_to_convert,
         string_result);
   free(string_result);
 
   char *string_to_convert = "1234";
   long long_result;
         string_result);
   free(string_result);
 
   char *string_to_convert = "1234";
   long long_result;
-  INFO1("Ask to convert %s", string_to_convert);
+  XBT_INFO("Ask to convert %s", string_to_convert);
   gras_msg_rpccall(toserver, 60, "convert a2i", &string_to_convert,
                    &long_result);
   gras_msg_rpccall(toserver, 60, "convert a2i", &string_to_convert,
                    &long_result);
-  INFO2("The server says that \"%s\" is equal to %d.", string_to_convert,
+  XBT_INFO("The server says that \"%s\" is equal to %d.", string_to_convert,
         long_result);
 
   xbt_ex_t e;
         long_result);
 
   xbt_ex_t e;
@@ -129,16 +129,16 @@ int client(int argc, char *argv[])
     gras_msg_rpccall(toserver, 60, "convert a2i", &string_to_convert,
                      &long_result);
   } CATCH(e) {
     gras_msg_rpccall(toserver, 60, "convert a2i", &string_to_convert,
                      &long_result);
   } CATCH(e) {
-    INFO1
+    XBT_INFO
         ("The server refuses to convert %s. Here is the received exception:",
          string_to_convert);
     xbt_ex_display(&e);
     xbt_ex_free(e);
         ("The server refuses to convert %s. Here is the received exception:",
          string_to_convert);
     xbt_ex_display(&e);
     xbt_ex_free(e);
-    INFO0("Again, previous exception was excepted");
+    XBT_INFO("Again, previous exception was excepted");
   }
 
   gras_msg_send(toserver, "done", NULL);
   }
 
   gras_msg_send(toserver, "done", NULL);
-  INFO0("Stopped the server");
+  XBT_INFO("Stopped the server");
 
   gras_exit();
   return 0;
 
   gras_exit();
   return 0;
index 4923f8d..d84463e 100644 (file)
@@ -28,11 +28,11 @@ int server_request_cb(gras_msg_cb_ctx_t ctx, void *payload)
 
   if (globals->process_in_CS) {
     xbt_dynar_push(globals->waiting_queue, &s);
 
   if (globals->process_in_CS) {
     xbt_dynar_push(globals->waiting_queue, &s);
-    INFO2("put %s:%d in waiting queue", gras_socket_peer_name(s),
+    XBT_INFO("put %s:%d in waiting queue", gras_socket_peer_name(s),
           gras_socket_peer_port(s));
   } else {
     globals->process_in_CS = 1;
           gras_socket_peer_port(s));
   } else {
     globals->process_in_CS = 1;
-    INFO2("grant %s:%d since nobody wanted it", gras_socket_peer_name(s),
+    XBT_INFO("grant %s:%d since nobody wanted it", gras_socket_peer_name(s),
           gras_socket_peer_port(s));
     gras_msg_send(s, "grant", NULL);
   }
           gras_socket_peer_port(s));
     gras_msg_send(s, "grant", NULL);
   }
@@ -47,7 +47,7 @@ int server_release_cb(gras_msg_cb_ctx_t ctx, void *payload)
     gras_socket_t s;
     xbt_dynar_pop(globals->waiting_queue, &s);
 
     gras_socket_t s;
     xbt_dynar_pop(globals->waiting_queue, &s);
 
-    INFO2("grant %s:%d since token released", gras_socket_peer_name(s),
+    XBT_INFO("grant %s:%d since token released", gras_socket_peer_name(s),
           gras_socket_peer_port(s));
     gras_msg_send(s, "grant", NULL);
   } else {
           gras_socket_peer_port(s));
     gras_msg_send(s, "grant", NULL);
   } else {
@@ -87,12 +87,12 @@ void lock(gras_socket_t toserver)
 {
   gras_msg_send(toserver, "request", NULL);
   gras_msg_wait(-1, "grant", NULL, NULL);
 {
   gras_msg_send(toserver, "request", NULL);
   gras_msg_wait(-1, "grant", NULL, NULL);
-  INFO0("Granted by server");
+  XBT_INFO("Granted by server");
 }                               /* end_of_lock */
 
 void unlock(gras_socket_t toserver)
 {
 }                               /* end_of_lock */
 
 void unlock(gras_socket_t toserver)
 {
-  INFO0("Release the token");
+  XBT_INFO("Release the token");
   gras_msg_send(toserver, "release", NULL);
 }                               /* end_of_unlock */
 
   gras_msg_send(toserver, "release", NULL);
 }                               /* end_of_unlock */
 
@@ -106,7 +106,7 @@ int client(int argc, char *argv[])
 
   mysock = gras_socket_server_range(1024, 10000, 0, 0);
 
 
   mysock = gras_socket_server_range(1024, 10000, 0, 0);
 
-  VERB1("Client ready; listening on %d", gras_socket_my_port(mysock));
+  XBT_VERB("Client ready; listening on %d", gras_socket_my_port(mysock));
 
   gras_os_sleep(1.5);           /* sleep 1 second and half */
   message_declaration();
 
   gras_os_sleep(1.5);           /* sleep 1 second and half */
   message_declaration();
index d9269e2..347abdb 100644 (file)
@@ -79,15 +79,10 @@ course, it's the only one).
 \until XBT_LOG
 
 Then, we change any call to fprintf to one of the logging macros. There is a
 \until XBT_LOG
 
 Then, we change any call to fprintf to one of the logging macros. There is a
-plenty of them, called &lt;priority&gt;&lt;nb args&gt;, such as #DEBUG10,
-which produces a debuging log event onto the default category. You have to
-declare the name of arguments as part of the macro name for compatibility
-with old compilers not accepting variable number of arguments. Here is a
-partial list of the existing macros: #DEBUG10, #VERB10, #INFO10, #WARN10,
-#ERROR10 and #CRITICAL10. For each priority, this is the biggest macro (and
-the others are not documented for sake of clarity in the relevant document).
-Ie, VERB20 does not exist, but VERB0 does exist. I may add more if someone
-wants more, but that should be enough for most purposes.
+plenty of them, called &lt;priority&gt;&lt;nb args&gt;, such as #XBT_DEBUG,
+which produces a debuging log event onto the default category. Here is a
+list of the existing macros: #XBT_DEBUG, #XBT_VERB, #XBT_INFO, #XBT_WARN,
+#XBT_ERROR and #XBT_CRITICAL.
 
 Note also that there is no need to add a '\\n' at the end of your format
 line, it gets automatically added.
 
 Note also that there is no need to add a '\\n' at the end of your format
 line, it gets automatically added.
index 5a0df31..2930369 100644 (file)
@@ -391,331 +391,324 @@ extern xbt_log_layout_t xbt_log_default_layout;
  */
 #ifdef _XBT_WIN32
 #include <stdlib.h>             /* calloc */
  */
 #ifdef _XBT_WIN32
 #include <stdlib.h>             /* calloc */
-#define _XBT_LOG_PRE(catv, prio) do {                            \
-     if (_XBT_LOG_ISENABLEDV(catv, prio)) {                      \
-       s_xbt_log_event_t _log_ev;                                \
-       _log_ev.cat = &(catv);                                    \
-       _log_ev.priority = (prio);                                \
-       _log_ev.fileName = __FILE__;                              \
-       _log_ev.functionName = _XBT_FUNCTION;                     \
-       _log_ev.lineNum = __LINE__;                               \
-       _log_ev.buffer = (char*) calloc(XBT_LOG_BUFF_SIZE + 1, sizeof(char)); \
-       _xbt_log_event_log(&_log_ev
+#define _XBT_LOG_EV_BUFFER_ZERO() \
+  _log_ev.buffer = (char*) calloc(XBT_LOG_BUFF_SIZE + 1, sizeof(char))
 #else
 #include <string.h>             /* memset */
 #else
 #include <string.h>             /* memset */
-#define _XBT_LOG_PRE(catv, prio) do {                            \
-     if (_XBT_LOG_ISENABLEDV(catv, prio)) {                      \
-       s_xbt_log_event_t _log_ev;                                \
-       _log_ev.cat = &(catv);                                    \
-       _log_ev.priority = (prio);                                \
-       _log_ev.fileName = __FILE__;                              \
-       _log_ev.functionName = _XBT_FUNCTION;                     \
-       _log_ev.lineNum = __LINE__;                               \
-       memset(_log_ev.buffer, 0, XBT_LOG_BUFF_SIZE);             \
-       _xbt_log_event_log(&_log_ev
-
+#define _XBT_LOG_EV_BUFFER_ZERO() \
+  memset(_log_ev.buffer, 0, XBT_LOG_BUFF_SIZE)
 #endif
 
 #endif
 
-#define _XBT_LOG_POST                          \
-                        );                      \
-     } } while(0)
-
-
 /* Logging Macros */
 
 #ifdef XBT_LOG_MAYDAY
 /* Logging Macros */
 
 #ifdef XBT_LOG_MAYDAY
-# define CLOG0(c, p, f)                   fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
-# define CLOG1(c, p, f,a1)                fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)
-# define CLOG2(c, p, f,a1,a2)             fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)
-# define CLOG3(c, p, f,a1,a2,a3)          fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)
-# define CLOG4(c, p, f,a1,a2,a3,a4)       fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)
-# define CLOG5(c, p, f,a1,a2,a3,a4,a5)    fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)
-# define CLOG6(c, p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6)
-# define CLOG7(c, p, f,a1,a2,a3,a4,a5,a6,a7) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7)
-# define CLOG8(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8)
-# define CLOG9(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8,a9)
-# define CLOG10(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
+# define XBT_CLOG_(cat, prio, f, ...) \
+  fprintf(stderr,"%s:%d:" f "%c", __FILE__, __LINE__, __VA_ARGS__)
+# define XBT_CLOG(cat, prio, ...) XBT_CLOG_(cat, prio, __VA_ARGS__, '\n')
+# define XBT_LOG(...) XBT_CLOG(0, __VA_ARGS__)
 #else
 #else
-# define CLOG0(c, p, f)                   _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f _XBT_LOG_POST
-# define CLOG1(c, p, f,a1)                _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1 _XBT_LOG_POST
-# define CLOG2(c, p, f,a1,a2)             _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2 _XBT_LOG_POST
-# define CLOG3(c, p, f,a1,a2,a3)          _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3 _XBT_LOG_POST
-# define CLOG4(c, p, f,a1,a2,a3,a4)       _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
-# define CLOG5(c, p, f,a1,a2,a3,a4,a5)    _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5 _XBT_LOG_POST
-# define CLOG6(c, p, f,a1,a2,a3,a4,a5,a6) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6 _XBT_LOG_POST
-# define CLOG7(c, p, f,a1,a2,a3,a4,a5,a6,a7) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6,a7 _XBT_LOG_POST
-# define CLOG8(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8 _XBT_LOG_POST
-# define CLOG9(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8,a9 _XBT_LOG_POST
-# define CLOG10(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 _XBT_LOG_POST
+# define XBT_CLOG_(catv, prio, ...)                                     \
+  do {                                                                  \
+    if (_XBT_LOG_ISENABLEDV(catv, prio)) {                              \
+      s_xbt_log_event_t _log_ev;                                        \
+      _log_ev.cat = &(catv);                                            \
+      _log_ev.priority = (prio);                                        \
+      _log_ev.fileName = __FILE__;                                      \
+      _log_ev.functionName = _XBT_FUNCTION;                             \
+      _log_ev.lineNum = __LINE__;                                       \
+      _XBT_LOG_EV_BUFFER_ZERO();                                        \
+      _xbt_log_event_log(&_log_ev, __VA_ARGS__);                        \
+    }                                                                   \
+  }  while (0)
+# define XBT_CLOG(cat, prio, ...) XBT_CLOG_(_XBT_LOGV(cat), prio, __VA_ARGS__)
+# define XBT_LOG(...) XBT_CLOG_((*_XBT_LOGV(default)), __VA_ARGS__)
 #endif
 #endif
-#define CDEBUG0(c, f)                   CLOG0(c, xbt_log_priority_debug, f)
-#define CDEBUG1(c, f,a1)                CLOG1(c, xbt_log_priority_debug, f,a1)
-#define CDEBUG2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_debug, f,a1,a2)
-#define CDEBUG3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_debug, f,a1,a2,a3)
-#define CDEBUG4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_debug, f,a1,a2,a3,a4)
-#define CDEBUG5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
-#define CDEBUG6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
-#define CDEBUG7(c, f,a1,a2,a3,a4,a5,a6,a7) CLOG7(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
-#define CDEBUG8(c, f,a1,a2,a3,a4,a5,a6,a7,a8) CLOG8(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8)
-#define CDEBUG9(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) CLOG9(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
+
 /** @ingroup XBT_log
  *  @hideinitializer
  * \param c the category on which to log
  * \param f the format string
 /** @ingroup XBT_log
  *  @hideinitializer
  * \param c the category on which to log
  * \param f the format string
- * \param a1 first argument of the format
- * \param a2 second argument of the format
- * \param a3 third argument of the format
- * \param a4 fourth argument of the format
- * \param a5 fifth argument of the format
- * \param a6 sixth argument of the format
- * \param a7 seventh argument of the format
- * \param a8 eighth argument of the format
- * \param a9 ninth argument of the format
- * \param a10 tenth argument of the format
- *  @brief Log an event at the DEBUG priority on the specified category with these args (CDEBUGn exists for any n<10).
- */
-#define CDEBUG10(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) CLOG10(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
-
-#define CVERB0(c, f)                   CLOG0(c, xbt_log_priority_verbose, f)
-#define CVERB1(c, f,a1)                CLOG1(c, xbt_log_priority_verbose, f,a1)
-#define CVERB2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_verbose, f,a1,a2)
-#define CVERB3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_verbose, f,a1,a2,a3)
-#define CVERB4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_verbose, f,a1,a2,a3,a4)
-#define CVERB5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
-#define CVERB6(c, f,a1,a2,a3,a4,a5,a6)    CLOG6(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
-#define CVERB7(c, f,a1,a2,a3,a4,a5,a6,a7)    CLOG7(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7)
-#define CVERB8(c, f,a1,a2,a3,a4,a5,a6,a7,a8)    CLOG8(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7,a8)
-#define CVERB9(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)    CLOG9(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
+ * \param ... arguments of the format
+ *  @brief Log an event at the DEBUG priority on the specified category with these args.
+ */
+#define XBT_CDEBUG(c, ...) XBT_CLOG(c, xbt_log_priority_debug, __VA_ARGS__)
+
 /** @ingroup XBT_log
  *  @hideinitializer
 /** @ingroup XBT_log
  *  @hideinitializer
- *  @brief Log an event at the VERB priority on the specified category with these args (CVERBn exists for any n<10).
- */
-#define CVERB10(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)    CLOG10(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
-
-#define CINFO0(c, f)                   CLOG0(c, xbt_log_priority_info, f)
-#define CINFO1(c, f,a1)                CLOG1(c, xbt_log_priority_info, f,a1)
-#define CINFO2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_info, f,a1,a2)
-#define CINFO3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_info, f,a1,a2,a3)
-#define CINFO4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_info, f,a1,a2,a3,a4)
-#define CINFO5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5)
-#define CINFO6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
-#define CINFO7(c, f,a1,a2,a3,a4,a5,a6,a7) CLOG7(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7)
-#define CINFO8(c, f,a1,a2,a3,a4,a5,a6,a7,a8) CLOG8(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7,a8)
-#define CINFO9(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) CLOG9(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
+ *  @brief Log an event at the VERB priority on the specified category with these args.
+ */
+#define XBT_CVERB(c, ...) XBT_CLOG(c, xbt_log_priority_verbose, __VA_ARGS__)
+
 /** @ingroup XBT_log
  *  @hideinitializer
 /** @ingroup XBT_log
  *  @hideinitializer
- *  @brief Log an event at the INFO priority on the specified category with these args (CINFOn exists for any n<10).
- */
-#define CINFO10(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) CLOG10(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
-
-#define CWARN0(c, f)                   CLOG0(c, xbt_log_priority_warning, f)
-#define CWARN1(c, f,a1)                CLOG1(c, xbt_log_priority_warning, f,a1)
-#define CWARN2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_warning, f,a1,a2)
-#define CWARN3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_warning, f,a1,a2,a3)
-#define CWARN4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_warning, f,a1,a2,a3,a4)
-#define CWARN5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
-#define CWARN6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
-#define CWARN7(c, f,a1,a2,a3,a4,a5,a6,a7) CLOG7(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7)
-#define CWARN8(c, f,a1,a2,a3,a4,a5,a6,a7,a8) CLOG8(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7,a8)
-#define CWARN9(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) CLOG9(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
+ *  @brief Log an event at the INFO priority on the specified category with these args.
+ */
+#define XBT_CINFO(c, ...) XBT_CLOG(c, xbt_log_priority_info, __VA_ARGS__)
+
 /** @ingroup XBT_log
  *  @hideinitializer
 /** @ingroup XBT_log
  *  @hideinitializer
- *  @brief Log an event at the WARN priority on the specified category with these args (CWARNn exists for any n<10).
- */
-#define CWARN10(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) CLOG10(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,10)
-
-#define CERROR0(c, f)                   CLOG0(c, xbt_log_priority_error, f)
-#define CERROR1(c, f,a1)                CLOG1(c, xbt_log_priority_error, f,a1)
-#define CERROR2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_error, f,a1,a2)
-#define CERROR3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_error, f,a1,a2,a3)
-#define CERROR4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_error, f,a1,a2,a3,a4)
-#define CERROR5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5)
-#define CERROR6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
-#define CERROR7(c, f,a1,a2,a3,a4,a5,a6,a7) CLOG7(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7)
-#define CERROR8(c, f,a1,a2,a3,a4,a5,a6,a7,a8) CLOG8(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7,a8)
-#define CERROR9(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) CLOG9(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
+ *  @brief Log an event at the WARN priority on the specified category with these args.
+ */
+#define XBT_CWARN(c, ...) XBT_CLOG(c, xbt_log_priority_warning, __VA_ARGS__)
+
 /** @ingroup XBT_log
  *  @hideinitializer
 /** @ingroup XBT_log
  *  @hideinitializer
- *  @brief Log an event at the ERROR priority on the specified category with these args (CERRORn exists for any n<10).
- */
-#define CERROR10(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) CLOG10(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
-
-#define CCRITICAL0(c, f)                   CLOG0(c, xbt_log_priority_critical, f)
-#define CCRITICAL1(c, f,a1)                CLOG1(c, xbt_log_priority_critical, f,a1)
-#define CCRITICAL2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_critical, f,a1,a2)
-#define CCRITICAL3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_critical, f,a1,a2,a3)
-#define CCRITICAL4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_critical, f,a1,a2,a3,a4)
-#define CCRITICAL5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
-#define CCRITICAL6(c, f,a1,a2,a3,a4,a5,a6)    CLOG6(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
-#define CCRITICAL7(c, f,a1,a2,a3,a4,a5,a6,a7)    CLOG7(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7)
-#define CCRITICAL8(c, f,a1,a2,a3,a4,a5,a6,a7,a8)    CLOG8(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7,a8)
-#define CCRITICAL9(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)    CLOG9(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
+ *  @brief Log an event at the ERROR priority on the specified category with these args.
+ */
+#define XBT_CERROR(c, ...) XBT_CLOG(c, xbt_log_priority_error, __VA_ARGS__)
+
 /** @ingroup XBT_log
  *  @hideinitializer
  *  @brief Log an event at the CRITICAL priority on the specified category with these args (CCRITICALn exists for any n<10).
  */
 /** @ingroup XBT_log
  *  @hideinitializer
  *  @brief Log an event at the CRITICAL priority on the specified category with these args (CCRITICALn exists for any n<10).
  */
-#define CCRITICAL10(c, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)    CLOG10(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
+#define XBT_CCRITICAL(c, ...) XBT_CLOG(c, xbt_log_priority_critical, __VA_ARGS__)
 
 
-#ifdef XBT_LOG_MAYDAY
-# define LOG0(p, f)                   fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
-# define LOG1(p, f,a1)                fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)
-# define LOG2(p, f,a1,a2)             fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)
-# define LOG3(p, f,a1,a2,a3)          fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)
-# define LOG4(p, f,a1,a2,a3,a4)       fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)
-# define LOG5(p, f,a1,a2,a3,a4,a5)    fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)
-# define LOG6(p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6)
-# define LOG7(p, f,a1,a2,a3,a4,a5,a6,a7) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7)
-# define LOG8(p, f,a1,a2,a3,a4,a5,a6,a7,a8) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8)
-# define LOG9(p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8,a9)
-# define LOG10(p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
-#else
-# define LOG0(p, f)                   _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f _XBT_LOG_POST
-# define LOG1(p, f,a1)                _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1 _XBT_LOG_POST
-# define LOG2(p, f,a1,a2)             _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2 _XBT_LOG_POST
-# define LOG3(p, f,a1,a2,a3)          _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3 _XBT_LOG_POST
-# define LOG4(p, f,a1,a2,a3,a4)       _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
-# define LOG5(p, f,a1,a2,a3,a4,a5)    _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5 _XBT_LOG_POST
-# define LOG6(p, f,a1,a2,a3,a4,a5,a6) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6 _XBT_LOG_POST
-# define LOG7(p, f,a1,a2,a3,a4,a5,a6,a7) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6,a7 _XBT_LOG_POST
-# define LOG8(p, f,a1,a2,a3,a4,a5,a6,a7,a8) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8 _XBT_LOG_POST
-# define LOG9(p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8,a9 _XBT_LOG_POST
-# define LOG10(p,f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 _XBT_LOG_POST
-#endif
-
-#define DEBUG0(f)                   LOG0(xbt_log_priority_debug, f)
-#define DEBUG1(f,a1)                LOG1(xbt_log_priority_debug, f,a1)
-#define DEBUG2(f,a1,a2)             LOG2(xbt_log_priority_debug, f,a1,a2)
-#define DEBUG3(f,a1,a2,a3)          LOG3(xbt_log_priority_debug, f,a1,a2,a3)
-#define DEBUG4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_debug, f,a1,a2,a3,a4)
-#define DEBUG5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
-#define DEBUG6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
-#define DEBUG7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
-#define DEBUG8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8)
-#define DEBUG9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) LOG9(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
 /** @ingroup XBT_log
  *  @hideinitializer
  * \param f the format string
 /** @ingroup XBT_log
  *  @hideinitializer
  * \param f the format string
- * \param a1 first argument of the format
- * \param a2 second argument of the format
- * \param a3 third argument of the format
- * \param a4 fourth argument of the format
- * \param a5 fifth argument of the format
- * \param a6 sixth argument of the format
- * \param a7 seventh argument of the format
- * \param a8 eighth argument of the format
- * \param a9 ninth argument of the format
- * \param a10 tenth argument of the format
- *  @brief Log an event at the DEBUG priority on the default category with these args (DEBUGn exists for any n<10)
- */
-#define DEBUG10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) LOG10(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
-
-#define VERB0(f)                   LOG0(xbt_log_priority_verbose, f)
-#define VERB1(f,a1)                LOG1(xbt_log_priority_verbose, f,a1)
-#define VERB2(f,a1,a2)             LOG2(xbt_log_priority_verbose, f,a1,a2)
-#define VERB3(f,a1,a2,a3)          LOG3(xbt_log_priority_verbose, f,a1,a2,a3)
-#define VERB4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_verbose, f,a1,a2,a3,a4)
-#define VERB5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
-#define VERB6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
-#define VERB7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7)
-#define VERB8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7,a8)
-#define VERB9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) LOG9(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
+ * \param ...
+ *  @brief Log an event at the DEBUG priority on the default category with these args.
+ */
+#define XBT_DEBUG(...) XBT_LOG(xbt_log_priority_debug, __VA_ARGS__)
+
 /** @ingroup XBT_log
  *  @hideinitializer
 /** @ingroup XBT_log
  *  @hideinitializer
- *  @brief Log an event at the VERB priority on the default category with these args (VERBn exists for any n<10).
- */
-#define VERB10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) LOG10(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
-
-#define INFO0(f)                   LOG0(xbt_log_priority_info, f)
-#define INFO1(f,a1)                LOG1(xbt_log_priority_info, f,a1)
-#define INFO2(f,a1,a2)             LOG2(xbt_log_priority_info, f,a1,a2)
-#define INFO3(f,a1,a2,a3)          LOG3(xbt_log_priority_info, f,a1,a2,a3)
-#define INFO4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_info, f,a1,a2,a3,a4)
-#define INFO5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_info, f,a1,a2,a3,a4,a5)
-#define INFO6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
-#define INFO7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7)
-#define INFO8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7,a8)
-#define INFO9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) LOG9(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
+ *  @brief Log an event at the VERB priority on the default category with these args.
+ */
+#define XBT_VERB(...) XBT_LOG(xbt_log_priority_verbose, __VA_ARGS__)
+
 /** @ingroup XBT_log
  *  @hideinitializer
 /** @ingroup XBT_log
  *  @hideinitializer
- *  @brief Log an event at the INFO priority on the default category with these args (INFOn exists for any n<10).
- */
-#define INFO10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) LOG10(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
-
-#define WARN0(f)                   LOG0(xbt_log_priority_warning, f)
-#define WARN1(f,a1)                LOG1(xbt_log_priority_warning, f,a1)
-#define WARN2(f,a1,a2)             LOG2(xbt_log_priority_warning, f,a1,a2)
-#define WARN3(f,a1,a2,a3)          LOG3(xbt_log_priority_warning, f,a1,a2,a3)
-#define WARN4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_warning, f,a1,a2,a3,a4)
-#define WARN5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
-#define WARN6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
-#define WARN7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7)
-#define WARN8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7,a8)
-#define WARN9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) LOG9(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
+ *  @brief Log an event at the INFO priority on the default category with these args.
+ */
+#define XBT_INFO(...) XBT_LOG(xbt_log_priority_info, __VA_ARGS__)
+
 /** @ingroup XBT_log
  *  @hideinitializer
 /** @ingroup XBT_log
  *  @hideinitializer
- *  @brief Log an event at the WARN priority on the default category with these args (WARNn exists for any n<10).
+ *  @brief Log an event at the WARN priority on the default category with these args.
  */
  */
-#define WARN10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) LOG10(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
+#define XBT_WARN(...) XBT_LOG(xbt_log_priority_warning, __VA_ARGS__)
 
 
-
-#define ERROR0(f)                   LOG0(xbt_log_priority_error, f)
-#define ERROR1(f,a1)                LOG1(xbt_log_priority_error, f,a1)
-#define ERROR2(f,a1,a2)             LOG2(xbt_log_priority_error, f,a1,a2)
-#define ERROR3(f,a1,a2,a3)          LOG3(xbt_log_priority_error, f,a1,a2,a3)
-#define ERROR4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_error, f,a1,a2,a3,a4)
-#define ERROR5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_error, f,a1,a2,a3,a4,a5)
-#define ERROR6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
-#define ERROR7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7)
-#define ERROR8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7,a8)
-#define ERROR9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) LOG9(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
 /** @ingroup XBT_log
  *  @hideinitializer
 /** @ingroup XBT_log
  *  @hideinitializer
- *  @brief Log an event at the ERROR priority on the default category with these args (ERRORn exists for any n<10).
- */
-#define ERROR10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) LOG10(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
-
-#define CRITICAL0(f)                   LOG0(xbt_log_priority_critical, f)
-#define CRITICAL1(f,a1)                LOG1(xbt_log_priority_critical, f,a1)
-#define CRITICAL2(f,a1,a2)             LOG2(xbt_log_priority_critical, f,a1,a2)
-#define CRITICAL3(f,a1,a2,a3)          LOG3(xbt_log_priority_critical, f,a1,a2,a3)
-#define CRITICAL4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_critical, f,a1,a2,a3,a4)
-#define CRITICAL5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
-#define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
-#define CRITICAL7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7)
-#define CRITICAL8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7,a8)
-#define CRITICAL9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) LOG9(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
+ *  @brief Log an event at the ERROR priority on the default category with these args.
+ */
+#define XBT_ERROR(...) XBT_LOG(xbt_log_priority_error, __VA_ARGS__)
+
 /** @ingroup XBT_log
  *  @hideinitializer
 /** @ingroup XBT_log
  *  @hideinitializer
- *  @brief Log an event at the CRITICAL priority on the default category with these args (CRITICALn exists for any n<10).
+ *  @brief Log an event at the CRITICAL priority on the default category with these args.
  */
  */
-#define CRITICAL10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) LOG10(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
+#define XBT_CRITICAL(...) XBT_LOG(xbt_log_priority_critical, __VA_ARGS__)
 
 /** @ingroup XBT_log
  *  @hideinitializer
  *  @brief Log at TRACE priority that we entered in current function.
  */
 
 /** @ingroup XBT_log
  *  @hideinitializer
  *  @brief Log at TRACE priority that we entered in current function.
  */
-#define XBT_IN               LOG1(xbt_log_priority_trace, ">> begin of %s",     _XBT_FUNCTION)
-#define XBT_IN1(fmt,a)       LOG2(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a)
-#define XBT_IN2(fmt,a,b)     LOG3(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b)
-#define XBT_IN3(fmt,a,b,c)   LOG4(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c)
-#define XBT_IN4(fmt,a,b,c,d) LOG5(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c,d)
+#define XBT_IN       XBT_IN_F("")
+
 /** @ingroup XBT_log
  *  @hideinitializer
 /** @ingroup XBT_log
  *  @hideinitializer
- *  @brief Log at TRACE priority that we entered in current function, appending a user specified format taking 5 args (XBT_INn exists for all n in [1,6])
+ *  @brief Log at TRACE priority that we entered in current function, appending a user specified format.
  */
  */
-#define XBT_IN5(fmt,a,b,c,d,e) LOG6(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c,d,e)
-#define XBT_IN6(fmt,a,b,c,d,e,f) LOG7(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c,d,e,f)
+#define XBT_IN_F(...) XBT_IN_F_(__VA_ARGS__, "")
+#define XBT_IN_F_(fmt, ...) \
+  XBT_LOG(xbt_log_priority_trace, ">> begin of %s" fmt "%s", \
+          _XBT_FUNCTION, __VA_ARGS__)
+
 /** @ingroup XBT_log
  *  @hideinitializer
  *  @brief Log at TRACE priority that we exited the current function.
  */
 /** @ingroup XBT_log
  *  @hideinitializer
  *  @brief Log at TRACE priority that we exited the current function.
  */
-#define XBT_OUT              LOG1(xbt_log_priority_trace, "<< end of %s",       _XBT_FUNCTION)
+#define XBT_OUT              XBT_LOG(xbt_log_priority_trace, "<< end of %s",       _XBT_FUNCTION)
+
 /** @ingroup XBT_log
  *  @hideinitializer
  *  @brief Log at TRACE priority a message indicating that we reached that point.
  */
 /** @ingroup XBT_log
  *  @hideinitializer
  *  @brief Log at TRACE priority a message indicating that we reached that point.
  */
-#define XBT_HERE             LOG0(xbt_log_priority_trace, "-- was here")
+#define XBT_HERE             XBT_LOG(xbt_log_priority_trace, "-- was here")
+
+#define XBT_LOG_OLD_STYLE
+#ifdef XBT_LOG_OLD_STYLE
+
+/* Kept for backward compatibility. */
+
+#define CLOG0(...) XBT_CLOG(__VA_ARGS__)
+#define CLOG1(...) XBT_CLOG(__VA_ARGS__)
+#define CLOG2(...) XBT_CLOG(__VA_ARGS__)
+#define CLOG3(...) XBT_CLOG(__VA_ARGS__)
+#define CLOG4(...) XBT_CLOG(__VA_ARGS__)
+#define CLOG5(...) XBT_CLOG(__VA_ARGS__)
+#define CLOG6(...) XBT_CLOG(__VA_ARGS__)
+#define CLOG7(...) XBT_CLOG(__VA_ARGS__)
+#define CLOG8(...) XBT_CLOG(__VA_ARGS__)
+#define CLOG9(...) XBT_CLOG(__VA_ARGS__)
+#define CLOG10(...) XBT_CLOG(__VA_ARGS__)
+
+#define CDEBUG0(...) XBT_CDEBUG(__VA_ARGS__)
+#define CDEBUG1(...) XBT_CDEBUG(__VA_ARGS__)
+#define CDEBUG2(...) XBT_CDEBUG(__VA_ARGS__)
+#define CDEBUG3(...) XBT_CDEBUG(__VA_ARGS__)
+#define CDEBUG4(...) XBT_CDEBUG(__VA_ARGS__)
+#define CDEBUG5(...) XBT_CDEBUG(__VA_ARGS__)
+#define CDEBUG6(...) XBT_CDEBUG(__VA_ARGS__)
+#define CDEBUG7(...) XBT_CDEBUG(__VA_ARGS__)
+#define CDEBUG8(...) XBT_CDEBUG(__VA_ARGS__)
+#define CDEBUG9(...) XBT_CDEBUG(__VA_ARGS__)
+#define CDEBUG10(...) XBT_CDEBUG(__VA_ARGS__)
+
+#define CVERB0(...) XBT_CVERB(__VA_ARGS__)
+#define CVERB1(...) XBT_CVERB(__VA_ARGS__)
+#define CVERB2(...) XBT_CVERB(__VA_ARGS__)
+#define CVERB3(...) XBT_CVERB(__VA_ARGS__)
+#define CVERB4(...) XBT_CVERB(__VA_ARGS__)
+#define CVERB5(...) XBT_CVERB(__VA_ARGS__)
+#define CVERB6(...) XBT_CVERB(__VA_ARGS__)
+#define CVERB7(...) XBT_CVERB(__VA_ARGS__)
+#define CVERB8(...) XBT_CVERB(__VA_ARGS__)
+#define CVERB9(...) XBT_CVERB(__VA_ARGS__)
+#define CVERB10(...) XBT_CVERB(__VA_ARGS__)
+
+#define CINFO0(...) XBT_CINFO(__VA_ARGS__)
+#define CINFO1(...) XBT_CINFO(__VA_ARGS__)
+#define CINFO2(...) XBT_CINFO(__VA_ARGS__)
+#define CINFO3(...) XBT_CINFO(__VA_ARGS__)
+#define CINFO4(...) XBT_CINFO(__VA_ARGS__)
+#define CINFO5(...) XBT_CINFO(__VA_ARGS__)
+#define CINFO6(...) XBT_CINFO(__VA_ARGS__)
+#define CINFO7(...) XBT_CINFO(__VA_ARGS__)
+#define CINFO8(...) XBT_CINFO(__VA_ARGS__)
+#define CINFO9(...) XBT_CINFO(__VA_ARGS__)
+#define CINFO10(...) XBT_CINFO(__VA_ARGS__)
+
+#define CWARN0(...) XBT_CWARN(__VA_ARGS__)
+#define CWARN1(...) XBT_CWARN(__VA_ARGS__)
+#define CWARN2(...) XBT_CWARN(__VA_ARGS__)
+#define CWARN3(...) XBT_CWARN(__VA_ARGS__)
+#define CWARN4(...) XBT_CWARN(__VA_ARGS__)
+#define CWARN5(...) XBT_CWARN(__VA_ARGS__)
+#define CWARN6(...) XBT_CWARN(__VA_ARGS__)
+#define CWARN7(...) XBT_CWARN(__VA_ARGS__)
+#define CWARN8(...) XBT_CWARN(__VA_ARGS__)
+#define CWARN9(...) XBT_CWARN(__VA_ARGS__)
+#define CWARN10(...) XBT_CWARN(__VA_ARGS__)
+
+#define CERROR0(...) XBT_CERROR(__VA_ARGS__)
+#define CERROR1(...) XBT_CERROR(__VA_ARGS__)
+#define CERROR2(...) XBT_CERROR(__VA_ARGS__)
+#define CERROR3(...) XBT_CERROR(__VA_ARGS__)
+#define CERROR4(...) XBT_CERROR(__VA_ARGS__)
+#define CERROR5(...) XBT_CERROR(__VA_ARGS__)
+#define CERROR6(...) XBT_CERROR(__VA_ARGS__)
+#define CERROR7(...) XBT_CERROR(__VA_ARGS__)
+#define CERROR8(...) XBT_CERROR(__VA_ARGS__)
+#define CERROR9(...) XBT_CERROR(__VA_ARGS__)
+#define CERROR10(...) XBT_CERROR(__VA_ARGS__)
+
+#define CCRITICAL0(...) XBT_CCRITICAL(__VA_ARGS__)
+#define CCRITICAL1(...) XBT_CCRITICAL(__VA_ARGS__)
+#define CCRITICAL2(...) XBT_CCRITICAL(__VA_ARGS__)
+#define CCRITICAL3(...) XBT_CCRITICAL(__VA_ARGS__)
+#define CCRITICAL4(...) XBT_CCRITICAL(__VA_ARGS__)
+#define CCRITICAL5(...) XBT_CCRITICAL(__VA_ARGS__)
+#define CCRITICAL6(...) XBT_CCRITICAL(__VA_ARGS__)
+#define CCRITICAL7(...) XBT_CCRITICAL(__VA_ARGS__)
+#define CCRITICAL8(...) XBT_CCRITICAL(__VA_ARGS__)
+#define CCRITICAL9(...) XBT_CCRITICAL(__VA_ARGS__)
+#define CCRITICAL10(...) XBT_CCRITICAL(__VA_ARGS__)
+
+#define LOG0(...) XBT_LOG(__VA_ARGS__)
+#define LOG1(...) XBT_LOG(__VA_ARGS__)
+#define LOG2(...) XBT_LOG(__VA_ARGS__)
+#define LOG3(...) XBT_LOG(__VA_ARGS__)
+#define LOG4(...) XBT_LOG(__VA_ARGS__)
+#define LOG5(...) XBT_LOG(__VA_ARGS__)
+#define LOG6(...) XBT_LOG(__VA_ARGS__)
+#define LOG7(...) XBT_LOG(__VA_ARGS__)
+#define LOG8(...) XBT_LOG(__VA_ARGS__)
+#define LOG9(...) XBT_LOG(__VA_ARGS__)
+#define LOG10(...) XBT_LOG(__VA_ARGS__)
+
+#define DEBUG0(...) XBT_DEBUG(__VA_ARGS__)
+#define DEBUG1(...) XBT_DEBUG(__VA_ARGS__)
+#define DEBUG2(...) XBT_DEBUG(__VA_ARGS__)
+#define DEBUG3(...) XBT_DEBUG(__VA_ARGS__)
+#define DEBUG4(...) XBT_DEBUG(__VA_ARGS__)
+#define DEBUG5(...) XBT_DEBUG(__VA_ARGS__)
+#define DEBUG6(...) XBT_DEBUG(__VA_ARGS__)
+#define DEBUG7(...) XBT_DEBUG(__VA_ARGS__)
+#define DEBUG8(...) XBT_DEBUG(__VA_ARGS__)
+#define DEBUG9(...) XBT_DEBUG(__VA_ARGS__)
+#define DEBUG10(...) XBT_DEBUG(__VA_ARGS__)
+
+#define VERB0(...) XBT_VERB(__VA_ARGS__)
+#define VERB1(...) XBT_VERB(__VA_ARGS__)
+#define VERB2(...) XBT_VERB(__VA_ARGS__)
+#define VERB3(...) XBT_VERB(__VA_ARGS__)
+#define VERB4(...) XBT_VERB(__VA_ARGS__)
+#define VERB5(...) XBT_VERB(__VA_ARGS__)
+#define VERB6(...) XBT_VERB(__VA_ARGS__)
+#define VERB7(...) XBT_VERB(__VA_ARGS__)
+#define VERB8(...) XBT_VERB(__VA_ARGS__)
+#define VERB9(...) XBT_VERB(__VA_ARGS__)
+#define VERB10(...) XBT_VERB(__VA_ARGS__)
+
+#define INFO0(...) XBT_INFO(__VA_ARGS__)
+#define INFO1(...) XBT_INFO(__VA_ARGS__)
+#define INFO2(...) XBT_INFO(__VA_ARGS__)
+#define INFO3(...) XBT_INFO(__VA_ARGS__)
+#define INFO4(...) XBT_INFO(__VA_ARGS__)
+#define INFO5(...) XBT_INFO(__VA_ARGS__)
+#define INFO6(...) XBT_INFO(__VA_ARGS__)
+#define INFO7(...) XBT_INFO(__VA_ARGS__)
+#define INFO8(...) XBT_INFO(__VA_ARGS__)
+#define INFO9(...) XBT_INFO(__VA_ARGS__)
+#define INFO10(...) XBT_INFO(__VA_ARGS__)
+
+#define WARN0(...) XBT_WARN(__VA_ARGS__)
+#define WARN1(...) XBT_WARN(__VA_ARGS__)
+#define WARN2(...) XBT_WARN(__VA_ARGS__)
+#define WARN3(...) XBT_WARN(__VA_ARGS__)
+#define WARN4(...) XBT_WARN(__VA_ARGS__)
+#define WARN5(...) XBT_WARN(__VA_ARGS__)
+#define WARN6(...) XBT_WARN(__VA_ARGS__)
+#define WARN7(...) XBT_WARN(__VA_ARGS__)
+#define WARN8(...) XBT_WARN(__VA_ARGS__)
+#define WARN9(...) XBT_WARN(__VA_ARGS__)
+#define WARN10(...) XBT_WARN(__VA_ARGS__)
+
+#define ERROR0(...) XBT_ERROR(__VA_ARGS__)
+#define ERROR1(...) XBT_ERROR(__VA_ARGS__)
+#define ERROR2(...) XBT_ERROR(__VA_ARGS__)
+#define ERROR3(...) XBT_ERROR(__VA_ARGS__)
+#define ERROR4(...) XBT_ERROR(__VA_ARGS__)
+#define ERROR5(...) XBT_ERROR(__VA_ARGS__)
+#define ERROR6(...) XBT_ERROR(__VA_ARGS__)
+#define ERROR7(...) XBT_ERROR(__VA_ARGS__)
+#define ERROR8(...) XBT_ERROR(__VA_ARGS__)
+#define ERROR9(...) XBT_ERROR(__VA_ARGS__)
+#define ERROR10(...) XBT_ERROR(__VA_ARGS__)
+
+#define CRITICAL0(...) XBT_CRITICAL(__VA_ARGS__)
+#define CRITICAL1(...) XBT_CRITICAL(__VA_ARGS__)
+#define CRITICAL2(...) XBT_CRITICAL(__VA_ARGS__)
+#define CRITICAL3(...) XBT_CRITICAL(__VA_ARGS__)
+#define CRITICAL4(...) XBT_CRITICAL(__VA_ARGS__)
+#define CRITICAL5(...) XBT_CRITICAL(__VA_ARGS__)
+#define CRITICAL6(...) XBT_CRITICAL(__VA_ARGS__)
+#define CRITICAL7(...) XBT_CRITICAL(__VA_ARGS__)
+#define CRITICAL8(...) XBT_CRITICAL(__VA_ARGS__)
+#define CRITICAL9(...) XBT_CRITICAL(__VA_ARGS__)
+#define CRITICAL10(...) XBT_CRITICAL(__VA_ARGS__)
+
+#define XBT_IN1(...) XBT_IN_F(__VA_ARGS__);
+#define XBT_IN2(...) XBT_IN_F(__VA_ARGS__);
+#define XBT_IN3(...) XBT_IN_F(__VA_ARGS__);
+#define XBT_IN4(...) XBT_IN_F(__VA_ARGS__);
+#define XBT_IN5(...) XBT_IN_F(__VA_ARGS__);
+#define XBT_IN6(...) XBT_IN_F(__VA_ARGS__);
 
 
+#endif
 
 SG_END_DECL()
 #endif                          /* ! _XBT_LOG_H_ */
 
 SG_END_DECL()
 #endif                          /* ! _XBT_LOG_H_ */
index b4e3010..479fc03 100644 (file)
@@ -182,14 +182,10 @@ compile with the -Wall option, gcc will warn you for unmatched arguments, ie
 when you pass a pointer to a string where an integer was specified by the
 format. This is usually a good idea.
 
 when you pass a pointer to a string where an integer was specified by the
 format. This is usually a good idea.
 
-Because some C compilers do not support vararg macros, there is a version of
-the macro for any number of arguments from 0 to 6. The macro name ends with
-the total number of arguments.
-
 Here is an example of the most basic type of macro. This is a logging
 request with priority <i>warning</i>.
 
 Here is an example of the most basic type of macro. This is a logging
 request with priority <i>warning</i>.
 
-<code>CLOG5(MyCat, gras_log_priority_warning, "Values are: %d and '%s'", 5,
+<code>XBT_CLOG(MyCat, gras_log_priority_warning, "Values are: %d and '%s'", 5,
 "oops");</code>
 
 A logging request is said to be enabled if its priority is higher than or
 "oops");</code>
 
 A logging request is said to be enabled if its priority is higher than or
@@ -202,7 +198,7 @@ example, one of the standard priorities is used, then there is a convenience
 macro that is typically used instead. For example, the above example is
 equivalent to the shorter:
 
 macro that is typically used instead. For example, the above example is
 equivalent to the shorter:
 
-<code>CWARN4(MyCat, "Values are: %d and '%s'", 5, "oops");</code>
+<code>XBT_CWARN(MyCat, "Values are: %d and '%s'", 5, "oops");</code>
 
 \section log_API_isenabled 2.3 Checking if a particular category/priority is enabled
 
 
 \section log_API_isenabled 2.3 Checking if a particular category/priority is enabled
 
@@ -220,7 +216,7 @@ If \ref XBT_LOG_NEW_DEFAULT_SUBCATEGORY(MyCat, Parent) or
 \ref XBT_LOG_NEW_DEFAULT_CATEGORY(MyCat) is used to create the
 category, then the even shorter form can be used:
 
 \ref XBT_LOG_NEW_DEFAULT_CATEGORY(MyCat) is used to create the
 category, then the even shorter form can be used:
 
-<code>WARN3("Values are: %s and '%d'", 5, "oops");</code>
+<code>XBT_WARN("Values are: %s and '%d'", 5, "oops");</code>
 
 Only one default category can be created per file, though multiple
 non-defaults can be created and used.
 
 Only one default category can be created per file, though multiple
 non-defaults can be created and used.
@@ -230,27 +226,21 @@ non-defaults can be created and used.
 First of all, each module should register its own category into the categories
 tree using \ref XBT_LOG_NEW_DEFAULT_SUBCATEGORY.
 
 First of all, each module should register its own category into the categories
 tree using \ref XBT_LOG_NEW_DEFAULT_SUBCATEGORY.
 
-Then, logging should be done with the DEBUG<n>, VERB<n>, INFO<n>, WARN<n>,
-ERROR<n> or CRITICAL<n> macro families (such as #DEBUG10, #VERB10,
-#INFO10, #WARN10, #ERROR10 and #CRITICAL10). For each group, there is at
-least 11 different macros (like DEBUG0, DEBUG1, DEBUG2, DEBUG3, DEBUG4 and
-DEBUG5, DEBUG6, DEBUG7, DEBUG8, DEBUG9, DEBUG10), only differing in the number of arguments passed along the format.
-This is because we want SimGrid itself to keep compilable on ancient
-compiler not supporting variable number of arguments to macros. But we
-should provide a macro simpler to use for the users not interested in SP3
-machines (FIXME).
+Then, logging should be done with the #XBT_DEBUG, #XBT_VERB, #XBT_INFO,
+#XBT_WARN, #XBT_ERROR and #XBT_CRITICAL macros.
 
 Under GCC, these macro check there arguments the same way than printf does. So,
 if you compile with -Wall, the following code will issue a warning:
 
 Under GCC, these macro check there arguments the same way than printf does. So,
 if you compile with -Wall, the following code will issue a warning:
-<code>DEBUG2("Found %s (id %f)", some_string, a_double)</code>
+<code>XBT_DEBUG("Found %s (id %d)", some_string, a_double)</code>
 
 If you want to specify the category to log onto (for example because you
 have more than one category per file, add a C before the name of the log
 
 If you want to specify the category to log onto (for example because you
 have more than one category per file, add a C before the name of the log
-producing macro (ie, use #CDEBUG10, #CVERB10, #CINFO10, #CWARN10, #CERROR10 and
-#CCRITICAL10 and friends), and pass the category name as first argument.
+producing macro (ie, use #XBT_CDEBUG, #XBT_CVERB, #XBT_CINFO, #XBT_CWARN,
+#XBT_CERROR and #XBT_CCRITICAL and friends), and pass the category name as
+first argument.
 
 The TRACE priority is not used the same way than the other. You should use
 
 The TRACE priority is not used the same way than the other. You should use
-the #XBT_IN, XBT_IN<n> (up to #XBT_IN5), #XBT_OUT and #XBT_HERE macros
+the #XBT_IN, #XBT_IN_F, #XBT_OUT and #XBT_HERE macros
 instead.
 
 \section log_API_example 2.6 Example of use
 instead.
 
 \section log_API_example 2.6 Example of use
@@ -269,17 +259,17 @@ int main() {
        xbt_log_control_set("SA.thresh:3");
 
        / * This request is enabled, because WARNING >= INFO. * /
        xbt_log_control_set("SA.thresh:3");
 
        / * This request is enabled, because WARNING >= INFO. * /
-       CWARN0(VSS, "Low fuel level.");
+       XBT_CWARN(VSS, "Low fuel level.");
 
        / * This request is disabled, because DEBUG < INFO. * /
 
        / * This request is disabled, because DEBUG < INFO. * /
-       CDEBUG0(VSS, "Starting search for nearest gas station.");
+       XBT_CDEBUG(VSS, "Starting search for nearest gas station.");
 
        / * The default category SA inherits its priority from VSS. Thus,
           the following request is enabled because INFO >= INFO.  * /
 
        / * The default category SA inherits its priority from VSS. Thus,
           the following request is enabled because INFO >= INFO.  * /
-       INFO0("Located nearest gas station.");
+       XBT_INFO("Located nearest gas station.");
 
        / * This request is disabled, because DEBUG < INFO. * /
 
        / * This request is disabled, because DEBUG < INFO. * /
-       DEBUG0("Exiting gas station search");
+       XBT_DEBUG("Exiting gas station search");
 }
 \endverbatim
 
 }
 \endverbatim