From 04e45f503b86a58a3cf26a5d9fc81bebcb04b271 Mon Sep 17 00:00:00 2001 From: Vito Piserchia Date: Thu, 3 Nov 2016 17:41:31 +0100 Subject: setup the debug function --- src/include/ndpi_define.h | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'src/include/ndpi_define.h') diff --git a/src/include/ndpi_define.h b/src/include/ndpi_define.h index ce6149e5e..b632712a1 100644 --- a/src/include/ndpi_define.h +++ b/src/include/ndpi_define.h @@ -180,29 +180,22 @@ #define NDPI_SOULSEEK_CONNECTION_IP_TICK_TIMEOUT 600 #ifdef NDPI_ENABLE_DEBUG_MESSAGES - -#define NDPI_LOG(proto, m, log_level, args...) \ - { \ +#define NDPI_LOG(proto, m, log_level, args...) \ + { \ struct ndpi_detection_module_struct *mod = (struct ndpi_detection_module_struct*) m; \ - if(mod != NULL) { \ - mod->ndpi_debug_print_file=__FILE__; \ - mod->ndpi_debug_print_function=__FUNCTION__; \ - mod->ndpi_debug_print_line=__LINE__; \ - if (mod->ndpi_debug_printf != NULL) \ - mod->ndpi_debug_printf(proto, mod, log_level, args); \ - else \ - printf(args, proto, mod, log_level); \ - } \ + if(mod != NULL) { \ + mod->ndpi_debug_print_file=__FILE__; \ + mod->ndpi_debug_print_function=__FUNCTION__; \ + mod->ndpi_debug_print_line=__LINE__; \ + (*(mod->ndpi_debug_printf))(proto, mod, log_level, args); \ + } \ } - #else /* NDPI_ENABLE_DEBUG_MESSAGES */ - #ifdef WIN32 #define NDPI_LOG(...) {} #else #define NDPI_LOG(proto, mod, log_level, args...) {} #endif - #endif /* NDPI_ENABLE_DEBUG_MESSAGES */ /** -- cgit v1.2.3