changeset 228:19de529ce7fb

Moved debug prefix to macro and added component specific prefix.
author Sascha Wilde <wilde@intevation.de>
date Thu, 27 Mar 2014 18:31:26 +0100
parents 29467940b07b
children e99e39d72af2
files cinst/mozilla.c common/debug.h
diffstat 2 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/cinst/mozilla.c	Thu Mar 27 18:24:08 2014 +0100
+++ b/cinst/mozilla.c	Thu Mar 27 18:31:26 2014 +0100
@@ -64,6 +64,8 @@
 #include "portpath.h"
 #include "strhelp.h"
 
+#define DEBUGPREFIX "MOZ-"
+
 #ifndef _WIN32
 #define CONFDIRS ".mozilla", ".thunderbird"
 #define TARGET_LINUX 1
@@ -104,7 +106,7 @@
     return cdir;
   else
     {
-      DEBUGPRINTF("DEBUG: FATAL!  No %s in environment.\n", envvar);
+      DEBUGPRINTF("FATAL!  No %s in environment.\n", envvar);
       exit(ERR_MOZ_HOMELESS);
     }
 }
@@ -135,7 +137,7 @@
 
   if ((inifile = fopen(inifile_name, "r")) != NULL)
     {
-      DEBUGPRINTF("DEBUG: Searching for profile paths in: '%s'\n", inifile_name);
+      DEBUGPRINTF("Searching for profile paths in: '%s'\n", inifile_name);
 
       inifile_dirname = port_dirname(inifile_name);
       while (fgets(line, LINEBUFLEN, inifile) != NULL)
@@ -163,13 +165,13 @@
                     strncpy(path, value, LINEBUFLEN);
                   if ((fqpath = port_realpath(path)) != NULL)
                     {
-                      DEBUGPRINTF("DEBUG: Found profile path: '%s'\n", fqpath);
+                      DEBUGPRINTF("Found profile path: '%s'\n", fqpath);
                       strv_append(&dirs, fqpath, strlen(fqpath));
                       free (fqpath);
                     }
                   else
                     {
-                      DEBUGPRINTF("DEBUG: WARN!  Non existent profile path: '%s'\n", path);
+                      DEBUGPRINTF("WARN!  Non existent profile path: '%s'\n", path);
                       return_code |= WARN_MOZ_PROFILE_DOES_NOT_EXIST;
                     }
                 }
@@ -182,7 +184,7 @@
     }
   else
     {
-      DEBUGPRINTF("DEBUG: WARN!  Could not open ini file: '%s'\n", inifile_name);
+      DEBUGPRINTF("WARN!  Could not open ini file: '%s'\n", inifile_name);
       return_code |= WARN_MOZ_FAILED_TO_OPEN_INI;
     }
   return dirs;
@@ -230,11 +232,11 @@
                            confdirs[i],
                            mozdirent->d_name,
                            "profiles.ini");
-                  DEBUGPRINTF("DEBUG: checking for %s...\n", path);
+                  DEBUGPRINTF("checking for %s...\n", path);
                   if ((fqpath = port_realpath(path)) != NULL)
                     {
                       strv_append(&inis, fqpath, strlen(fqpath));
-                      DEBUGPRINTF("DEBUG: Found mozilla ini file: '%s'\n", fqpath);
+                      DEBUGPRINTF("Found mozilla ini file: '%s'\n", fqpath);
                       free(fqpath);
                     }
                 }
@@ -243,12 +245,12 @@
         }
       else
         {
-          DEBUGPRINTF("DEBUG: Could not open %s/%s\n", confbase, confdirs[i]);
+          DEBUGPRINTF("Could not open %s/%s\n", confbase, confdirs[i]);
         }
     }
   if (inis == NULL)
     {
-      DEBUGPRINTF("DEBUG: No ini files found - will do nothing!\n");
+      DEBUGPRINTF("No ini files found - will do nothing!\n");
       exit(WARN_MOZ_NO_PROFILES);
     }
   return inis;
--- a/common/debug.h	Thu Mar 27 18:24:08 2014 +0100
+++ b/common/debug.h	Thu Mar 27 18:31:26 2014 +0100
@@ -12,7 +12,7 @@
  * Prints to stderr if RELEASE_BUILD is not defined.
  */
 #ifndef RELEASE_BUILD
-#define DEBUGPRINTF(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__);
+#define DEBUGPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__);
 #else
 #define DEBUGPRINTF(fmt, ...)
 #endif

http://wald.intevation.org/projects/trustbridge/