Commit 574ed8e5 authored by Ghislain MARY's avatar Ghislain MARY

Add API to activate the serialization of logs.

parent b17cab31
......@@ -64,6 +64,7 @@ static const char *liblinphone_version=
LIBLINPHONE_VERSION
#endif
;
static bool_t liblinphone_serialize_logs = FALSE;
static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime);
static void linphone_core_run_hooks(LinphoneCore *lc);
static void linphone_core_free_hooks(LinphoneCore *lc);
......@@ -480,11 +481,15 @@ void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc){
* @ingroup misc
* @deprecated Use #linphone_core_set_log_level instead.
**/
void linphone_core_disable_logs(){
void linphone_core_disable_logs(void){
ortp_set_log_level_mask(ORTP_ERROR|ORTP_FATAL);
sal_disable_logs();
}
void linphone_core_serialize_logs(void) {
liblinphone_serialize_logs = TRUE;
}
static void net_config_read (LinphoneCore *lc)
{
......@@ -1331,7 +1336,9 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab
linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up");
ortp_init();
ortp_set_log_thread_id(ortp_thread_self());
if (liblinphone_serialize_logs == TRUE) {
ortp_set_log_thread_id(ortp_thread_self());
}
lc->dyn_pt=96;
lc->default_profile=rtp_profile_new("default profile");
linphone_core_assign_payload_type(lc,&payload_type_pcmu8000,0,NULL);
......@@ -2397,7 +2404,9 @@ void linphone_core_iterate(LinphoneCore *lc){
}
}
ortp_logv_flush();
if (liblinphone_serialize_logs == TRUE) {
ortp_logv_flush();
}
}
/**
......@@ -6038,7 +6047,9 @@ static void linphone_core_uninit(LinphoneCore *lc)
linphone_core_message_storage_close(lc);
ms_exit();
linphone_core_set_state(lc,LinphoneGlobalOff,"Off");
ortp_set_log_thread_id(0);
if (liblinphone_serialize_logs == TRUE) {
ortp_set_log_thread_id(0);
}
}
static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime){
......
......@@ -1674,6 +1674,14 @@ LINPHONE_PUBLIC void linphone_core_set_log_level(OrtpLogLevel loglevel);
LINPHONE_PUBLIC void linphone_core_enable_logs(FILE *file);
LINPHONE_PUBLIC void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc);
LINPHONE_PUBLIC void linphone_core_disable_logs(void);
/**
* Enable logs serialization (output logs from either the thread that creates the linphone core or the thread that calls linphone_core_iterate()).
* Must be called before creating the linphone core.
* @ingroup misc
*/
LINPHONE_PUBLIC void linphone_core_serialize_logs(void);
LINPHONE_PUBLIC const char *linphone_core_get_version(void);
LINPHONE_PUBLIC const char *linphone_core_get_user_agent(LinphoneCore *lc);
/**
......
oRTP @ dfb505d7
Subproject commit fc8d8457eb630907eff50333ddf5243b448fe733
Subproject commit dfb505d7198dc8be59919c8c6d68add302a98fd3
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