diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index c85be1c1a..22e53b7a0 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -516,6 +516,19 @@ char * linphone_core_compress_log_collection(LinphoneCore *core) { return ms_strdup_printf("%s/%s", liblinphone_log_collection_path ? liblinphone_log_collection_path : ".", COMPRESSED_LOG_COLLECTION_FILENAME); } +void linphone_core_reset_log_collection(LinphoneCore *core) { + char *filename; + ortp_mutex_lock(&liblinphone_log_collection_mutex); + delete_log_collection_upload_file(); + filename = ms_strdup_printf("%s/%s", liblinphone_log_collection_path ? liblinphone_log_collection_path : ".", "linphone1.log"); + unlink(filename); + ms_free(filename); + filename = ms_strdup_printf("%s/%s", liblinphone_log_collection_path ? liblinphone_log_collection_path : ".", "linphone2.log"); + unlink(filename); + ms_free(filename); + ortp_mutex_unlock(&liblinphone_log_collection_mutex); +} + /** * Enable logs in supplied FILE*. * diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index ec4ab8d1d..c35b7187a 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1817,6 +1817,13 @@ LINPHONE_PUBLIC void linphone_core_upload_log_collection(LinphoneCore *core); */ LINPHONE_PUBLIC char * linphone_core_compress_log_collection(LinphoneCore *core); +/** + * Reset the log collection by removing the log files. + * @ingroup misc + * @param[in] core LinphoneCore object + */ +LINPHONE_PUBLIC void linphone_core_reset_log_collection(LinphoneCore *core); + /** * Define a log handler. *