mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Fix logging service once for all.
This commit is contained in:
parent
15739433fb
commit
00e015436d
4 changed files with 16 additions and 5 deletions
|
|
@ -486,7 +486,7 @@ const LinphoneAddress *linphone_core_get_current_call_remote_address(struct _Lin
|
|||
|
||||
static void linphone_core_log_collection_handler(const char *domain, OrtpLogLevel level, const char *fmt, va_list args);
|
||||
|
||||
void linphone_core_set_log_handler(OrtpLogFunc logfunc) {
|
||||
void _linphone_core_set_log_handler(OrtpLogFunc logfunc) {
|
||||
liblinphone_user_log_func = logfunc;
|
||||
if (liblinphone_current_log_func == linphone_core_log_collection_handler) {
|
||||
ms_message("There is already a log collection handler, keep it");
|
||||
|
|
@ -495,9 +495,13 @@ void linphone_core_set_log_handler(OrtpLogFunc logfunc) {
|
|||
}
|
||||
}
|
||||
|
||||
void linphone_core_set_log_handler(OrtpLogFunc logfunc){
|
||||
_linphone_core_set_log_handler(logfunc);
|
||||
}
|
||||
|
||||
void linphone_core_set_log_file(FILE *file) {
|
||||
if (file == NULL) file = stdout;
|
||||
linphone_core_set_log_handler(NULL);
|
||||
_linphone_core_set_log_handler(NULL);
|
||||
bctbx_set_log_file(file); /*gather everythings*/
|
||||
}
|
||||
|
||||
|
|
@ -1046,7 +1050,7 @@ void linphone_core_enable_logs(FILE *file){
|
|||
}
|
||||
|
||||
void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc){
|
||||
linphone_core_set_log_handler(logfunc);
|
||||
_linphone_core_set_log_handler(logfunc);
|
||||
linphone_core_set_log_level(ORTP_MESSAGE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ static const char *_linphone_logging_service_log_domains[] = {
|
|||
"ortp",
|
||||
"mediastreamer",
|
||||
"bzrtp",
|
||||
"linphone",
|
||||
BCTBX_LOG_DOMAIN, /* which is "liblinphone", set from CMakeList.txt*/
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -238,6 +238,11 @@ void linphone_logging_service_cbs_unref(LinphoneLoggingServiceCbs *cbs) {
|
|||
}
|
||||
|
||||
void linphone_logging_service_cbs_set_log_message_written(LinphoneLoggingServiceCbs *cbs, LinphoneLoggingServiceCbsLogMessageWrittenCb cb) {
|
||||
/* We need to set the legacy log handler to NULL here
|
||||
because LinphoneCore have a default log handler that dump
|
||||
all messages into the standard output. */
|
||||
/*this function is moved here to make sure default log handler is only removed when user defined logging cbs is set*/
|
||||
_linphone_core_set_log_handler(NULL);
|
||||
cbs->message_event_cb = cb;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -558,6 +558,8 @@ LinphoneNatPolicy * linphone_config_create_nat_policy_from_section(const Linphon
|
|||
SalCustomHeader *linphone_info_message_get_headers (const LinphoneInfoMessage *im);
|
||||
void linphone_info_message_set_headers (LinphoneInfoMessage *im, const SalCustomHeader *headers);
|
||||
|
||||
void _linphone_core_set_log_handler(OrtpLogFunc logfunc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -807,7 +807,7 @@ LINPHONE_PUBLIC void linphone_core_reset_log_collection(void);
|
|||
/**
|
||||
* @bref Define a log handler.
|
||||
* @param logfunc The function pointer of the log handler.
|
||||
* @deprecated Use #linphone_log_service_set_log_handler() instead. Deprecated since 2017-10-10.
|
||||
* @deprecated Use #linphone_logging_service_cbs_set_log_message_written() instead. Deprecated since 2017-10-10.
|
||||
* @donotwrap
|
||||
*/
|
||||
LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_set_log_handler(OrtpLogFunc logfunc);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue