From cda952083fa6fa3bbdd90a20b062f1ddf9f97e65 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Mon, 1 Nov 2010 18:48:28 -0500 Subject: [PATCH] skypopen: nice formatted debug output (I feel so stupid when I use one full hour for things like this, but I like it ;) ) --- src/mod/endpoints/mod_skypopen/skypopen.h | 14 +++++++------- src/mod/endpoints/mod_skypopen/skypopen_protocol.c | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index 90f5df0bc9..f256202031 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -103,14 +103,14 @@ typedef enum { GFLAG_MY_CODEC_PREFS = (1 << 0) } GFLAGS; -#define DEBUGA_SKYPE(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rev "SKYPOPEN_SVN_VERSION "[%p|%-7lx][DEBUG_SKYPE %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ ); -#define DEBUGA_CALL(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rev "SKYPOPEN_SVN_VERSION "[%p|%-7lx][DEBUG_CALL %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ ); -#define DEBUGA_PBX(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rev "SKYPOPEN_SVN_VERSION "[%p|%-7lx][DEBUG_PBX %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ ); -#define ERRORA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "rev "SKYPOPEN_SVN_VERSION "[%p|%-7lx][ERRORA %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ ); -#define WARNINGA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "rev "SKYPOPEN_SVN_VERSION "[%p|%-7lx][WARNINGA %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ ); -#define NOTICA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "rev "SKYPOPEN_SVN_VERSION "[%p|%-7lx][NOTICA %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ ); +#define DEBUGA_SKYPE(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [DEBUG_SKYPE %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define DEBUGA_CALL(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [DEBUG_CALL %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define DEBUGA_PBX(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [DEBUG_PBX %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define ERRORA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [ERRORA %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define WARNINGA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%-*s["SKYPOPEN_SVN_VERSION "]\t [WARNINGA %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define NOTICA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [NOTICA %-5d][%-15s][%s,%s] " __VA_ARGS__ ); -#define SKYPOPEN_P_LOG NULL, (unsigned long)55, __LINE__, tech_pvt ? tech_pvt->name ? tech_pvt->name : "none" : "none", -1, tech_pvt ? tech_pvt->interface_state : -1, tech_pvt ? tech_pvt->skype_callflow : -1 +#define SKYPOPEN_P_LOG (int)((25 - (strlen(__FILE__))) + ((__LINE__ - 1000) < 0)), " ", __LINE__, tech_pvt ? tech_pvt->name ? tech_pvt->name : "none" : "none", tech_pvt ? interface_status[tech_pvt->interface_state] : "N/A", tech_pvt ? skype_callflow[tech_pvt->skype_callflow] : "N/A" /*********************************/ #define SKYPOPEN_CAUSE_NORMAL 1 diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 8bd5d095ac..496e05c783 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -15,6 +15,8 @@ extern switch_endpoint_interface_t *skypopen_endpoint_interface; int samplerate_skypopen = SAMPLERATE_SKYPOPEN; extern int running; +extern char *interface_status[]; +extern char *skype_callflow[]; /*************************************/ /* suspicious globals FIXME */