Mercurial > hg > forks > geeqie
changeset 2574:450bb9089427
Improve debug output
Use __func__ compiler identifier
author | Colin Clark <colin.clark@cclark.uk> |
---|---|
date | Tue, 08 Aug 2017 22:10:21 +0100 |
parents | 3e5919841759 |
children | c231b2cb9842 |
files | src/debug.c src/debug.h |
diffstat | 2 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/debug.c Tue Aug 08 19:30:01 2017 +0100 +++ b/src/debug.c Tue Aug 08 22:10:21 2017 +0100 @@ -85,7 +85,7 @@ g_free(buf); } -void log_domain_print_debug(const gchar *domain, const gchar *file_name, +void log_domain_print_debug(const gchar *domain, const gchar *file_name, const gchar *function_name, int line_number, const gchar *format, ...) { va_list ap; @@ -97,7 +97,7 @@ message = g_strdup_vprintf(format, ap); va_end(ap); - location = g_strdup_printf("%s:%d:", file_name, line_number); + location = g_strdup_printf("%s:%s:%d:", file_name, function_name, line_number); buf = g_strconcat(location, message, NULL); log_domain_print_message(domain,buf); g_free(location);
--- a/src/debug.h Tue Aug 08 19:30:01 2017 +0100 +++ b/src/debug.h Tue Aug 08 22:10:21 2017 +0100 @@ -27,8 +27,8 @@ #define DOMAIN_INFO "info" void log_domain_printf(const gchar *domain, const gchar *format, ...) G_GNUC_PRINTF(2, 3); -void log_domain_print_debug(const gchar *domain, const gchar *file_name, - int line_number, const gchar *format, ...) G_GNUC_PRINTF(4, 5); +void log_domain_print_debug(const gchar *domain, const gchar *file_name, const gchar *function_name, + int line_number, const gchar *format, ...) G_GNUC_PRINTF(5, 6); #define log_printf(...) log_domain_printf(DOMAIN_INFO, __VA_ARGS__) #ifdef DEBUG @@ -51,9 +51,9 @@ if (debug_level >= (n)) \ { \ if (debug_level != 1) \ - { \ - log_domain_print_debug(DOMAIN_DEBUG, __FILE__, __LINE__, __VA_ARGS__); \ - } \ + { \ + log_domain_printf(DOMAIN_DEBUG, "%s:%s:%d: ", __FILE__, __func__, __LINE__); \ + } \ else \ { \ log_domain_printf(DOMAIN_DEBUG, __VA_ARGS__); \