diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-11-22 02:06:41 +0400 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-01-14 23:36:38 +0100 |
commit | 226ea7a96485f2b9db13b523551c536dc68a1689 (patch) | |
tree | c2e90a49e934d31ca6e22678888e63c07785f856 /slirp/debug.h | |
parent | 2a2d3e4a258b9ed7ef5be7c6e421d58a365a0297 (diff) | |
download | qemu-226ea7a96485f2b9db13b523551c536dc68a1689.zip qemu-226ea7a96485f2b9db13b523551c536dc68a1689.tar.gz qemu-226ea7a96485f2b9db13b523551c536dc68a1689.tar.bz2 |
slirp: call into g_debug() for DEBUG macros
Make slirp use GLib logging, instead of fprintf(), so that
applications can filter log, process it etc.
With recent versions of glib, G_MESSAGES_DEBUG must be set to "all" or
"Slirp" to see slirp debug messages.
Reformat DEBUG_MISC & DEBUG_ERROR calls to not need \n ending.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/debug.h')
-rw-r--r-- | slirp/debug.h | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/slirp/debug.h b/slirp/debug.h index 50f3089..25a5d59 100644 --- a/slirp/debug.h +++ b/slirp/debug.h @@ -12,38 +12,29 @@ #define DBG_MISC 0x2 #define DBG_ERROR 0x4 -#define dfd stderr - extern int slirp_debug; #define DEBUG_CALL(fmt, ...) do { \ if (slirp_debug & DBG_CALL) { \ - fprintf(dfd, fmt, ##__VA_ARGS__); \ - fprintf(dfd, "...\n"); \ - fflush(dfd); \ + g_debug(fmt "...", ##__VA_ARGS__); \ } \ } while (0) #define DEBUG_ARG(fmt, ...) do { \ if (slirp_debug & DBG_CALL) { \ - fputc(' ', dfd); \ - fprintf(dfd, fmt, ##__VA_ARGS__); \ - fputc('\n', dfd); \ - fflush(dfd); \ + g_debug(" " fmt, ##__VA_ARGS__); \ } \ } while (0) #define DEBUG_MISC(fmt, ...) do { \ if (slirp_debug & DBG_MISC) { \ - fprintf(dfd, fmt, ##__VA_ARGS__); \ - fflush(dfd); \ + g_debug(fmt, ##__VA_ARGS__); \ } \ } while (0) #define DEBUG_ERROR(fmt, ...) do { \ if (slirp_debug & DBG_ERROR) { \ - fprintf(dfd, fmt, ##__VA_ARGS__); \ - fflush(dfd); \ + g_debug(fmt, ##__VA_ARGS__); \ } \ } while (0) |