mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
logging: use sal_set_log_level instead of sal_enable_logs and sal_disable_logs so that we have a finer control of logs verbosity
This commit is contained in:
parent
c3cd2a6d11
commit
794ccbaad5
3 changed files with 42 additions and 14 deletions
|
|
@ -87,12 +87,37 @@ void _belle_sip_log(belle_sip_log_level lev, const char *fmt, va_list args) {
|
|||
}
|
||||
}
|
||||
|
||||
void sal_enable_logs(){
|
||||
belle_sip_set_log_level(BELLE_SIP_LOG_MESSAGE);
|
||||
void sal_enable_log(){
|
||||
sal_set_log_level(ORTP_MESSAGE);
|
||||
}
|
||||
|
||||
void sal_disable_logs() {
|
||||
belle_sip_set_log_level(BELLE_SIP_LOG_ERROR);
|
||||
void sal_disable_log() {
|
||||
sal_set_log_level(ORTP_ERROR);
|
||||
}
|
||||
|
||||
void sal_set_log_level(OrtpLogLevel level) {
|
||||
belle_sip_log_level belle_sip_level;
|
||||
switch (level) {
|
||||
case ORTP_FATAL:
|
||||
belle_sip_level = BELLE_SIP_LOG_FATAL;
|
||||
break;
|
||||
case ORTP_ERROR:
|
||||
belle_sip_level = BELLE_SIP_LOG_ERROR;
|
||||
break;
|
||||
case ORTP_WARNING:
|
||||
belle_sip_level = BELLE_SIP_LOG_WARNING;
|
||||
break;
|
||||
case ORTP_MESSAGE:
|
||||
belle_sip_level = BELLE_SIP_LOG_MESSAGE;
|
||||
break;
|
||||
case ORTP_DEBUG:
|
||||
case ORTP_TRACE:
|
||||
belle_sip_level = BELLE_SIP_LOG_DEBUG;
|
||||
break;
|
||||
case ORTP_LOGLEV_END:
|
||||
return;
|
||||
}
|
||||
belle_sip_set_log_level(belle_sip_level);
|
||||
}
|
||||
|
||||
void sal_add_pending_auth(Sal *sal, SalOp *op){
|
||||
|
|
|
|||
|
|
@ -177,9 +177,9 @@ void linphone_core_set_log_level(OrtpLogLevel loglevel) {
|
|||
void linphone_core_set_log_level_mask(OrtpLogLevel loglevel) {
|
||||
ortp_set_log_level_mask(loglevel);
|
||||
if (loglevel == 0) {
|
||||
sal_disable_logs();
|
||||
sal_disable_log();
|
||||
} else {
|
||||
sal_enable_logs();
|
||||
sal_enable_log();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -662,8 +662,8 @@ void linphone_core_reset_log_collection() {
|
|||
void linphone_core_enable_logs(FILE *file){
|
||||
if (file==NULL) file=stdout;
|
||||
ortp_set_log_file(file);
|
||||
ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
|
||||
sal_enable_logs();
|
||||
ortp_set_log_level(ORTP_MESSAGE);
|
||||
sal_set_log_level(ORTP_MESSAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -677,9 +677,9 @@ void linphone_core_enable_logs(FILE *file){
|
|||
*
|
||||
**/
|
||||
void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc){
|
||||
ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
|
||||
ortp_set_log_level(ORTP_MESSAGE);
|
||||
linphone_core_set_log_handler(logfunc);
|
||||
sal_enable_logs();
|
||||
sal_set_log_level(ORTP_MESSAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -689,8 +689,8 @@ void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc){
|
|||
* @deprecated Use #linphone_core_set_log_level instead.
|
||||
**/
|
||||
void linphone_core_disable_logs(void){
|
||||
ortp_set_log_level_mask(ORTP_ERROR|ORTP_FATAL);
|
||||
sal_disable_logs();
|
||||
ortp_set_log_level(ORTP_ERROR);
|
||||
sal_set_log_level(ORTP_ERROR);
|
||||
}
|
||||
|
||||
void linphone_core_serialize_logs(void) {
|
||||
|
|
|
|||
|
|
@ -777,8 +777,11 @@ const SalCustomHeader *sal_op_get_recv_custom_header(SalOp *op);
|
|||
|
||||
void sal_op_set_sent_custom_header(SalOp *op, SalCustomHeader* ch);
|
||||
|
||||
void sal_enable_logs();
|
||||
void sal_disable_logs();
|
||||
/** deprecated. use sal_set_log_level instead **/
|
||||
void sal_enable_log();
|
||||
/** deprecated. use sal_set_log_level instead **/
|
||||
void sal_disable_log();
|
||||
void sal_set_log_level(OrtpLogLevel level);
|
||||
|
||||
/*internal API */
|
||||
void __sal_op_init(SalOp *b, Sal *sal);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue