Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Partially revert previous change: we indeed want a virtualization layer for time...
[simgrid.git] / src / xbt / xbt_log_layout_format.c
index 0b33f77..86c34f6 100644 (file)
@@ -10,7 +10,8 @@
 #include "portable.h" /* execinfo when available */
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
-#include "gras/virtu.h"
+#include "gras/virtu.h" /* gras_os_myname (KILLME) */
+#include "xbt/synchro.h" /* xbt_thread_self_name */
 #include <stdio.h>
 
 extern const char *xbt_log_priority_names[7];
@@ -79,7 +80,15 @@ static char *xbt_log_layout_format_doit(xbt_log_layout_t l,
           precision = -1;
        }        
        break;
-      case 't': /* process name; LOG4J compliant (thread name) */
+      case 't': /* thread name; LOG4J compliant */
+       if (precision == -1)
+          p += sprintf(p, "%s", xbt_thread_self_name());
+        else {       
+          p += sprintf(p, "%.*s", precision, xbt_thread_self_name());
+          precision = -1;
+       }        
+       break;
+      case 'P': /* process name; SimGrid extension */
        if (precision == -1)
           p += sprintf(p, "%s", xbt_procname());
         else {