X-Git-Url: http://sjero.net/git/?p=linphone;a=blobdiff_plain;f=coreapi%2Flinphonecore.c;h=5f70f45e158e1a6fd08d64226aa2a0def26c21df;hp=f4782908aa15e0962c07627b82b35593814bba39;hb=f0136172b063c81e399dea3c2b325d66e7b3fab3;hpb=f8728ffca088b8dc292ae5071d0f772b118acc16 diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f4782908..5f70f45e 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -407,10 +407,29 @@ const LinphoneAddress *linphone_core_get_current_call_remote_address(struct _Lin return linphone_call_get_remote_address(call); } +void linphone_core_set_log_handler(OrtpLogFunc logfunc) { + ortp_set_log_handler(logfunc); +} + +void linphone_core_set_log_file(FILE *file) { + if (file == NULL) file = stdout; + ortp_set_log_file(file); +} + +void linphone_core_set_log_level(OrtpLogLevel loglevel) { + ortp_set_log_level_mask(loglevel); + if (loglevel == 0) { + sal_disable_logs(); + } else { + sal_enable_logs(); + } +} + /** * Enable logs in supplied FILE*. * * @ingroup misc + * @deprecated Use #linphone_core_set_log_file and #linphone_core_set_log_level instead. * * @param file a C FILE* where to fprintf logs. If null stdout is used. * @@ -425,6 +444,7 @@ void linphone_core_enable_logs(FILE *file){ * Enable logs through the user's supplied log callback. * * @ingroup misc + * @deprecated Use #linphone_core_set_log_handler and #linphone_core_set_log_level instead. * * @param logfunc The address of a OrtpLogFunc callback whose protoype is * typedef void (*OrtpLogFunc)(OrtpLogLevel lev, const char *fmt, va_list args); @@ -439,6 +459,7 @@ void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc){ * Entirely disable logging. * * @ingroup misc + * @deprecated Use #linphone_core_set_log_level instead. **/ void linphone_core_disable_logs(){ ortp_set_log_level_mask(ORTP_ERROR|ORTP_FATAL); @@ -1197,6 +1218,7 @@ static void misc_config_read (LinphoneCore *lc) { LpConfig *config=lc->config; lc->max_call_logs=lp_config_get_int(config,"misc","history_max_size",15); lc->max_calls=lp_config_get_int(config,"misc","max_calls",NB_MAX_CALLS); + linphone_core_set_log_level((OrtpLogLevel)lp_config_get_int(config,"misc","log_level",0)); } @@ -2152,9 +2174,13 @@ void linphone_core_iterate(LinphoneCore *lc){ lc->initial_subscribes_sent=TRUE; } - if (one_second_elapsed && lp_config_needs_commit(lc->config)){ - lp_config_sync(lc->config); - } + if (one_second_elapsed) { + if (ortp_get_log_level_mask() != lp_config_get_int(lc->config, "misc", "log_level", 0)) { + lp_config_set_int(lc->config, "misc", "log_level", ortp_get_log_level_mask()); + } + if (lp_config_needs_commit(lc->config)) { + lp_config_sync(lc->config); + } } /**