log with pid
authorChristian Grothoff <christian@grothoff.org>
Sat, 27 Feb 2010 12:09:30 +0000 (12:09 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 27 Feb 2010 12:09:30 +0000 (12:09 +0000)
src/util/common_logging.c

index b0c97df7db2738d752389bc686fffe97c9a67258..8769e8e0c79968c03a56724f8644a9af5dcae143 100644 (file)
@@ -106,7 +106,7 @@ static const char *last_bulk_comp;
 /**
  * Running component.
  */
-static const char *component;
+static char *component;
 
 /**
  * Minimum log level.
@@ -163,7 +163,11 @@ GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile)
 {
   FILE *altlog;
 
-  component = comp;
+  GNUNET_free_non_null (component);
+  GNUNET_asprintf (&component,
+                  "%s-%d",
+                  comp,
+                  getpid());
   min_level = get_type (loglevel);
   if (logfile == NULL)
     return GNUNET_OK;
@@ -240,7 +244,7 @@ output_message (enum GNUNET_ErrorType kind,
 {
   struct CustomLogger *pos;
   if (GNUNET_stderr != NULL)
-    fprintf (GNUNET_stderr, "%s %s %s %s", datestr, comp,
+    fprintf (GNUNET_stderr, "%s %s %s %s", datestr, comp, 
              GNUNET_error_type_to_string (kind), msg);
   pos = loggers;
   while (pos != NULL)