diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e715d9e78..8e6316b54 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -250,16 +250,20 @@ void linphone_core_set_log_collection_upload_server_url(LinphoneCore *core, cons lp_config_set_string(core->config, "misc", "log_collection_upload_server_url", server_url); } -void linphone_core_enable_log_collection(bool_t enable) { +void linphone_core_enable_log_collection(LinphoneLogCollectionState state) { /* at first call of this function, set liblinphone_log_func to the current * ortp log function */ if( liblinphone_log_func == NULL ){ liblinphone_log_func = ortp_logv_out; } - if ((enable == TRUE) && (liblinphone_log_collection_enabled == FALSE)) { + if ((state != LinphoneLogCollectionDisabled) && (liblinphone_log_collection_enabled == FALSE)) { liblinphone_log_collection_enabled = TRUE; ortp_mutex_init(&liblinphone_log_collection_mutex, NULL); - liblinphone_log_func = ortp_logv_out; + if (state == LinphoneLogCollectionEnabledWithoutPreviousLogHandler) { + liblinphone_log_func = NULL; + } else { + liblinphone_log_func = ortp_logv_out; + } ortp_set_log_handler(linphone_core_log_collection_handler); } else { liblinphone_log_collection_enabled = FALSE; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 99fe701ea..be9e367a4 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1780,12 +1780,18 @@ typedef void * (*LinphoneCoreWaitingCallback)(LinphoneCore *lc, void *context, L /* THE main API */ +typedef enum _LinphoneLogCollectionState { + LinphoneLogCollectionDisabled, + LinphoneLogCollectionEnabled, + LinphoneLogCollectionEnabledWithoutPreviousLogHandler +} LinphoneLogCollectionState; + /** * Enable the linphone core log collection to upload logs on a server. * @ingroup misc - * @param[in] enable Boolean value telling whether to enable log collection or not. + * @param[in] state LinphoneLogCollectionState value telling whether to enable log collection or not. */ -LINPHONE_PUBLIC void linphone_core_enable_log_collection(bool_t enable); +LINPHONE_PUBLIC void linphone_core_enable_log_collection(LinphoneLogCollectionState state); /** * Set the path where the log files will be written for log collection.