Commit ba815377 authored by Ghislain MARY's avatar Ghislain MARY

Change API of linphone_core_enable_log_collection() to be able to deactivate...

Change API of linphone_core_enable_log_collection() to be able to deactivate the previous log handler.
parent 62fd80b8
......@@ -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;
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment