[Mono-dev] [RFC] Debug messages and eglib

Andreas Färber andreas.faerber at web.de
Sat Apr 3 09:35:32 EDT 2010


When debugging, e.g., mono/io-layer/processes.c (s/#undef DEBUG/ 
#define DEBUG/), there are a lot of g_message invocations, leading to  
unreadable console output. The following patch helps improve the  
readability by forcing newlines inside eglib:

diff --git a/eglib/src/goutput.c b/eglib/src/goutput.c
index 3a12201..ba82993 100644
--- a/eglib/src/goutput.c
+++ b/eglib/src/goutput.c
@@ -68,7 +68,7 @@ g_logv (const gchar *log_domain, GLogLevelFlags  
log_level, const gchar *format,
  	char *msg;
  	vasprintf (&msg, format, args);
-	printf ("%s%s%s",
+	printf ("%s%s%s\n",
  		log_domain != NULL ? log_domain : "",
  		log_domain != NULL ? ": " : "",

Grep'ing through the sources for g_message, there are occasions of  
both trailing and missing \n. glib documentation [1] seems to make no  
promises about newlines, so I'd consider the above a hack...

Should the dozens of callers be fixed to emit a trailing \n?


[1] http://library.gnome.org/devel/glib/2.24/glib-Message-Logging.html#g-logv

More information about the Mono-devel-list mailing list