mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-31 18:29:29 +00:00
small rework of trace level management.
This commit is contained in:
parent
8c98297aa4
commit
552be2a639
11 changed files with 48 additions and 52 deletions
|
|
@ -59,31 +59,6 @@ void sal_op_set_privacy_from_message(SalOp* op,belle_sip_message_t* msg) {
|
|||
}
|
||||
static void set_tls_properties(Sal *ctx);
|
||||
|
||||
void _belle_sip_log(const char *domain, belle_sip_log_level lev, const char *fmt, va_list args) {
|
||||
OrtpLogLevel ortp_level;
|
||||
switch(lev) {
|
||||
case BELLE_SIP_LOG_FATAL:
|
||||
ortp_level=ORTP_FATAL;
|
||||
break;
|
||||
case BELLE_SIP_LOG_ERROR:
|
||||
ortp_level=ORTP_ERROR;
|
||||
break;
|
||||
case BELLE_SIP_LOG_WARNING:
|
||||
ortp_level=ORTP_WARNING;
|
||||
break;
|
||||
case BELLE_SIP_LOG_MESSAGE:
|
||||
ortp_level=ORTP_MESSAGE;
|
||||
break;
|
||||
case BELLE_SIP_LOG_DEBUG:
|
||||
default:
|
||||
ortp_level=ORTP_DEBUG;
|
||||
break;
|
||||
}
|
||||
if (ortp_log_level_enabled("belle-sip", ortp_level)){
|
||||
ortp_logv("belle-sip", ortp_level,fmt,args);
|
||||
}
|
||||
}
|
||||
|
||||
void sal_enable_log(){
|
||||
sal_set_log_level(ORTP_MESSAGE);
|
||||
}
|
||||
|
|
@ -93,24 +68,31 @@ void sal_disable_log() {
|
|||
}
|
||||
|
||||
void sal_set_log_level(OrtpLogLevel level) {
|
||||
belle_sip_log_level belle_sip_level;
|
||||
belle_sip_log_level belle_sip_level = BELLE_SIP_LOG_MESSAGE;
|
||||
if ((level&ORTP_FATAL) != 0) {
|
||||
belle_sip_level = BELLE_SIP_LOG_FATAL;
|
||||
} else if ((level&ORTP_ERROR) != 0) {
|
||||
}
|
||||
if ((level&ORTP_ERROR) != 0) {
|
||||
belle_sip_level = BELLE_SIP_LOG_ERROR;
|
||||
} else if ((level&ORTP_WARNING) != 0) {
|
||||
}
|
||||
if ((level&ORTP_WARNING) != 0) {
|
||||
belle_sip_level = BELLE_SIP_LOG_WARNING;
|
||||
} else if ((level&ORTP_MESSAGE) != 0) {
|
||||
belle_sip_level = BELLE_SIP_LOG_MESSAGE;
|
||||
} else if (((level&ORTP_DEBUG) != 0) || ((level&ORTP_TRACE) != 0)) {
|
||||
belle_sip_level = BELLE_SIP_LOG_DEBUG;
|
||||
} else {
|
||||
//well, this should never occurs but...
|
||||
}
|
||||
if ((level&ORTP_MESSAGE) != 0) {
|
||||
belle_sip_level = BELLE_SIP_LOG_MESSAGE;
|
||||
}
|
||||
if (((level&ORTP_DEBUG) != 0) || ((level&ORTP_TRACE) != 0)) {
|
||||
belle_sip_level = BELLE_SIP_LOG_DEBUG;
|
||||
}
|
||||
|
||||
belle_sip_set_log_level(belle_sip_level);
|
||||
}
|
||||
static BctbxLogFunc _belle_sip_log_handler = bctbx_logv_out;
|
||||
|
||||
void sal_set_log_handler(BctbxLogFunc log_handler) {
|
||||
_belle_sip_log_handler = log_handler;
|
||||
belle_sip_set_log_handler(log_handler);
|
||||
}
|
||||
void sal_add_pending_auth(Sal *sal, SalOp *op){
|
||||
if (bctbx_list_find(sal->pending_auths,op)==NULL){
|
||||
sal->pending_auths=bctbx_list_append(sal->pending_auths,op);
|
||||
|
|
@ -505,7 +487,7 @@ Sal * sal_init(MSFactory *factory){
|
|||
sal->auto_contacts=TRUE;
|
||||
sal->factory = factory;
|
||||
/*first create the stack, which initializes the belle-sip object's pool for this thread*/
|
||||
belle_sip_set_log_handler(_belle_sip_log);
|
||||
belle_sip_set_log_handler(_belle_sip_log_handler); //printf by default
|
||||
sal->stack = belle_sip_stack_new(NULL);
|
||||
|
||||
sal->user_agent=belle_sip_header_user_agent_new();
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ if (ENABLE_TOOLS)
|
|||
string(REPLACE ".c" "" EXECUTABLE_NAME ${EXECUTABLE})
|
||||
bc_apply_compile_flags(${EXECUTABLE} STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
|
||||
add_executable(${EXECUTABLE_NAME} ${USE_BUNDLE} ${EXECUTABLE})
|
||||
target_link_libraries(${EXECUTABLE_NAME} ${LINPHONE_LIBS_FOR_TOOLS} ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES})
|
||||
target_link_libraries(${EXECUTABLE_NAME} ${LINPHONE_LIBS_FOR_TOOLS} ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES})
|
||||
set_target_properties(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
|
||||
if (NOT IOS)
|
||||
install(TARGETS ${EXECUTABLE_NAME}
|
||||
|
|
|
|||
|
|
@ -468,7 +468,9 @@ void linphone_core_set_log_handler(OrtpLogFunc logfunc) {
|
|||
|
||||
void linphone_core_set_log_file(FILE *file) {
|
||||
if (file == NULL) file = stdout;
|
||||
ortp_set_log_file(file);
|
||||
bctbx_set_log_file(file); /*gather everythings*/
|
||||
sal_set_log_handler(NULL); /*disable default log handler*/
|
||||
ortp_set_log_handler(NULL); /*disable default log handler*/
|
||||
}
|
||||
|
||||
void linphone_core_set_log_level(OrtpLogLevel loglevel) {
|
||||
|
|
@ -497,15 +499,13 @@ void linphone_core_set_log_level(OrtpLogLevel loglevel) {
|
|||
}
|
||||
|
||||
void linphone_core_set_log_level_mask(unsigned int loglevel) {
|
||||
ortp_set_log_level_mask(NULL, loglevel);
|
||||
bctbx_set_log_level_mask(NULL, loglevel);
|
||||
if (loglevel == 0) {
|
||||
sal_disable_log();
|
||||
} else {
|
||||
sal_enable_log();
|
||||
}
|
||||
//we only have 2 domain for now ortp and belle-sip
|
||||
bctbx_set_log_level_mask(ORTP_LOG_DOMAIN, loglevel);
|
||||
sal_set_log_level((OrtpLogLevel)loglevel);
|
||||
}
|
||||
unsigned int linphone_core_get_log_level_mask(void) {
|
||||
return bctbx_get_log_level_mask(ORTP_LOG_DOMAIN);
|
||||
}
|
||||
|
||||
static int _open_log_collection_file_with_idx(int idx) {
|
||||
struct stat statbuf;
|
||||
char *log_filename;
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ target_link_libraries(linphone-daemon ${LINPHONE_LIBS_FOR_TOOLS} ${MEDIASTREAMER
|
|||
set_target_properties(linphone-daemon PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
|
||||
|
||||
add_executable(linphone-daemon-pipetest ${DAEMON_PIPETEST_SOURCE_FILES})
|
||||
target_link_libraries(linphone-daemon-pipetest ${LINPHONE_LIBS_FOR_TOOLS} ${ORTP_LIBRARIES})
|
||||
target_link_libraries(linphone-daemon-pipetest ${LINPHONE_LIBS_FOR_TOOLS} ${ORTP_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES})
|
||||
set_target_properties(linphone-daemon-pipetest PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
|
||||
|
||||
set(INSTALL_TARGETS linphone-daemon linphone-daemon-pipetest)
|
||||
|
|
|
|||
|
|
@ -803,6 +803,14 @@ LINPHONE_PUBLIC void linphone_core_set_log_level(OrtpLogLevel loglevel);
|
|||
*/
|
||||
LINPHONE_PUBLIC void linphone_core_set_log_level_mask(unsigned int loglevel);
|
||||
|
||||
/**
|
||||
* Get defined log level mask.
|
||||
*
|
||||
* @return The loglevel parameter is a bitmask parameter. Therefore to enable only warning and error
|
||||
* messages, use ORTP_WARNING | ORTP_ERROR. To disable logs, simply set loglevel to 0.
|
||||
*/
|
||||
LINPHONE_PUBLIC unsigned int linphone_core_get_log_level_mask(void);
|
||||
|
||||
/**
|
||||
* Enable logs in supplied FILE*.
|
||||
* @param file a C FILE* where to fprintf logs. If null stdout is used.
|
||||
|
|
|
|||
|
|
@ -148,6 +148,8 @@ const char *sal_address_get_header(const SalAddress *addr, const char *name);
|
|||
|
||||
LINPHONE_PUBLIC Sal * sal_init(MSFactory *factory);
|
||||
LINPHONE_PUBLIC void sal_uninit(Sal* sal);
|
||||
|
||||
void sal_set_log_handler(BctbxLogFunc log_handler);
|
||||
void sal_set_user_pointer(Sal *sal, void *user_data);
|
||||
void *sal_get_user_pointer(const Sal *sal);
|
||||
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ static LinphoneAddress *account_manager_check_account(AccountManager *m, Linphon
|
|||
void linphone_core_manager_check_accounts(LinphoneCoreManager *m){
|
||||
const bctbx_list_t *it;
|
||||
AccountManager *am=account_manager_get();
|
||||
int logmask = ortp_get_log_level_mask(NULL);
|
||||
int logmask = linphone_core_get_log_level_mask();
|
||||
|
||||
if (!liblinphonetester_show_account_manager_logs) linphone_core_set_log_level_mask(ORTP_ERROR|ORTP_FATAL);
|
||||
for(it=linphone_core_get_proxy_config_list(m->lc);it!=NULL;it=it->next){
|
||||
|
|
|
|||
|
|
@ -195,8 +195,7 @@ int liblinphone_tester_set_log_file(const char *filename) {
|
|||
return -1;
|
||||
}
|
||||
ms_message("Redirecting traces to file [%s]", filename);
|
||||
bctbx_set_log_file(log_file);
|
||||
ortp_set_log_file(log_file);
|
||||
linphone_core_set_log_file(log_file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -684,6 +684,11 @@ static void proxy_transport_change(void){
|
|||
linphone_core_manager_destroy(lcm);
|
||||
|
||||
}
|
||||
/*
|
||||
* On ios, some firewal require to disable flow label (livebox with default firewall level).
|
||||
* sudo sysctl net.inet6.ip6.auto_flowlabel=0
|
||||
* It might be possible to found a sockopt for such purpose.
|
||||
*/
|
||||
static void proxy_transport_change_with_wrong_port(void) {
|
||||
LinphoneCoreManager* lcm = create_lcm();
|
||||
stats* counters = &lcm->stat;
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ void linphone_core_manager_stop(LinphoneCoreManager *mgr){
|
|||
}
|
||||
|
||||
void linphone_core_manager_uninit(LinphoneCoreManager *mgr) {
|
||||
int old_log_level = ortp_get_log_level_mask(NULL);
|
||||
int old_log_level = linphone_core_get_log_level_mask();
|
||||
linphone_core_set_log_level(ORTP_ERROR);
|
||||
if (mgr->phone_alias) {
|
||||
ms_free(mgr->phone_alias);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ endif()
|
|||
set(LP_AUTO_ANSWER_SOURCE_FILES auto_answer.c)
|
||||
bc_apply_compile_flags(LP_AUTO_ANSWER_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
|
||||
add_executable(lp-auto-answer ${USE_BUNDLE} ${LP_AUTO_ANSWER_SOURCE_FILES})
|
||||
target_link_libraries(lp-auto-answer ${LINPHONE_LIBS_FOR_TOOLS} ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES} ${BCTOOLBOX_LIBRARIES})
|
||||
target_link_libraries(lp-auto-answer ${LINPHONE_LIBS_FOR_TOOLS} ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES})
|
||||
set_target_properties(lp-auto-answer PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
|
||||
|
||||
set(LP_SENDMSG_SOURCE_FILES lpsendmsg.c)
|
||||
|
|
@ -57,7 +57,7 @@ set_target_properties(xml2lpc_test PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
|
|||
set(LP_TEST_ECC_SOURCE_FILES test_ecc.c)
|
||||
bc_apply_compile_flags(LP_TEST_ECC_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
|
||||
add_executable(lp-test-ecc ${USE_BUNDLE} ${LP_TEST_ECC_SOURCE_FILES})
|
||||
target_link_libraries(lp-test-ecc ${LINPHONE_LIBS_FOR_TOOLS} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
|
||||
target_link_libraries(lp-test-ecc ${LINPHONE_LIBS_FOR_TOOLS} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES})
|
||||
set_target_properties(lp-test-ecc PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
|
||||
|
||||
if (NOT IOS)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue