Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Insist on not letting solaris try to print NULL since this leads this poor soul to...
[simgrid.git] / src / xbt / log_default_appender.c
index dde8bda..1bac48d 100644 (file)
@@ -2,7 +2,7 @@
 
 /* file_appender - a dumb log appender which simply prints to stdout        */
 
-/* Copyright (c) 2004 Martin Quinson. All rights reserved.                  */
+/* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved.            */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -41,7 +41,11 @@ static void append_file(xbt_log_appender_t this,
 
   /* TODO: define a format field in struct for timestamp, etc.
      struct DefaultLogAppender* this = (struct DefaultLogAppender*)this0;*/
-    
+
+  char *procname = (char*)xbt_procname();
+  if (!procname) 
+     procname = (char*)"";
+   
     if ((FILE*)(this->appender_data) == NULL)
       this->appender_data = (void*)stderr;
     
@@ -51,9 +55,9 @@ static void append_file(xbt_log_appender_t this,
                 "Priority %d is greater than the biggest allowed value",
                 ev->priority);
 
-    fprintf(stderr, "%s:%d: ", ev->fileName, ev->lineNum);
+    fprintf(stderr, "[%s] %s:%d: ", procname, ev->fileName, ev->lineNum);
     fprintf(stderr, "[%s/%s] ", 
-           ev->cat->name, xbt_log_priority_names[ev->priority]);
+           ev->cat->name, xbt_log_priority_names[ev->priority] );
     vfprintf(stderr, fmt, ev->ap);
     fprintf(stderr, "\n");
 }