[epiphany/mcatanzaro/ephy-log] debug: LOG() should print only the file basename



commit a6716ca0a46714863008ed969767470d87775d56
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Fri Mar 1 19:59:13 2019 -0600

    debug: LOG() should print only the file basename
    
    It's hard to focus on the important bits when every debug log statement
    begins with
    [ ../../../../Projects/epiphany/embed/web-extension/ephy-web-extension.c ].
    So let's trim it down to [ ephy-web-extension.c ]. Much better.

 lib/ephy-debug.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/lib/ephy-debug.h b/lib/ephy-debug.h
index e98c12999..6dc155c1f 100644
--- a/lib/ephy-debug.h
+++ b/lib/ephy-debug.h
@@ -25,9 +25,10 @@
 G_BEGIN_DECLS
 
 #if DEVELOPER_MODE
-#define LOG(msg, args...)               g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,                \
-                                    "[ %s ] " msg,                             \
-                                    __FILE__ , ## args)
+#define LOG(msg, args...) G_STMT_START { \
+    g_autofree char *ephy_log_file_basename = g_path_get_basename (__FILE__); \
+    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "[ %s ] " msg, ephy_log_file_basename, ## args); \
+  } G_STMT_END
 #else
 #define LOG(...) G_STMT_START { } G_STMT_END
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]