diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 27965a84e..633360a7a 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -287,24 +287,19 @@ static void linphone_core_log_collection_handler(OrtpLogLevel level, const char ortp_gettimeofday(&tp, NULL); tt = (time_t)tp.tv_sec; lt = localtime((const time_t*)&tt); - switch(level){ - case ORTP_DEBUG: - lname = "DEBUG"; - break; - case ORTP_MESSAGE: - lname = "MESSAGE"; - break; - case ORTP_WARNING: - lname = "WARNING"; - break; - case ORTP_ERROR: - lname = "ERROR"; - break; - case ORTP_FATAL: - lname = "FATAL"; - break; - default: - ortp_fatal("Bad level !"); + + if ((level & ORTP_DEBUG) != 0) { + lname = "DEBUG"; + } else if ((level & ORTP_MESSAGE) != 0) { + lname = "MESSAGE"; + } else if ((level & ORTP_WARNING) != 0) { + lname = "WARNING"; + } else if ((level & ORTP_ERROR) != 0) { + lname = "ERROR"; + } else if ((level & ORTP_FATAL) != 0) { + lname = "FATAL"; + } else { + ortp_fatal("Bad level !"); } msg = ortp_strdup_vprintf(fmt, args); @@ -725,42 +720,17 @@ void linphone_core_reset_log_collection(void) { ortp_mutex_unlock(&liblinphone_log_collection_mutex); } -/** - * Enable logs in supplied FILE*. - * - * @ingroup misc - * @deprecated Use #linphone_core_set_log_file and #linphone_core_set_log_level instead. - * - * @param file a C FILE* where to fprintf logs. If null stdout is used. - * -**/ void linphone_core_enable_logs(FILE *file){ if (file==NULL) file=stdout; ortp_set_log_file(file); linphone_core_set_log_level(ORTP_MESSAGE); } -/** - * Enable logs through the user's supplied log callback. - * - * @ingroup misc - * @deprecated Use #linphone_core_set_log_handler and #linphone_core_set_log_level instead. - * - * @param logfunc The address of a OrtpLogFunc callback whose protoype is - * typedef void (*OrtpLogFunc)(OrtpLogLevel lev, const char *fmt, va_list args); - * -**/ void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc){ linphone_core_set_log_level(ORTP_MESSAGE); linphone_core_set_log_handler(logfunc); } -/** - * Entirely disable logging. - * - * @ingroup misc - * @deprecated Use #linphone_core_set_log_level instead. -**/ void linphone_core_disable_logs(void){ linphone_core_set_log_level(ORTP_ERROR); } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 6fa40625a..0fb78538e 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -2303,8 +2303,36 @@ LINPHONE_PUBLIC void linphone_core_set_log_level(OrtpLogLevel loglevel); * @param loglevel A bitmask of the log levels to set. */ LINPHONE_PUBLIC void linphone_core_set_log_level_mask(OrtpLogLevel loglevel); + +/** + * Enable logs in supplied FILE*. + * + * @ingroup misc + * @deprecated Use #linphone_core_set_log_file and #linphone_core_set_log_level instead. + * + * @param file a C FILE* where to fprintf logs. If null stdout is used. + * +**/ LINPHONE_PUBLIC void linphone_core_enable_logs(FILE *file); + +/** + * Enable logs through the user's supplied log callback. + * + * @ingroup misc + * @deprecated Use #linphone_core_set_log_handler and #linphone_core_set_log_level instead. + * + * @param logfunc The address of a OrtpLogFunc callback whose protoype is + * typedef void (*OrtpLogFunc)(OrtpLogLevel lev, const char *fmt, va_list args); + * +**/ LINPHONE_PUBLIC void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc); + +/** + * Entirely disable logging. + * + * @ingroup misc + * @deprecated Use #linphone_core_set_log_level instead. +**/ LINPHONE_PUBLIC void linphone_core_disable_logs(void); /** diff --git a/oRTP b/oRTP index 16848a37a..761cfd7c0 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 16848a37aa9c0231a8fd0bfd201b05ebaae81fff +Subproject commit 761cfd7c0eb76359b0dabeffd6533071b41a2914