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.
*
* 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);
* 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);
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));
}
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);
+ }
}
/**
/* THE main API */
+/**
+ * Define a log handler.
+ *
+ * @ingroup misc
+ *
+ * @param logfunc The function pointer of the log handler.
+ */
+void linphone_core_set_log_handler(OrtpLogFunc logfunc);
+/**
+ * Define a log file.
+ *
+ * @ingroup misc
+ *
+ * If the file pointer passed as an argument is NULL, stdout is used instead.
+ *
+ * @param file A pointer to the FILE structure of the file to write to.
+ */
+void linphone_core_set_log_file(FILE *file);
+/**
+ * Define the log level.
+ *
+ * @ingroup misc
+ *
+ * The loglevel parameter is a bitmask parameter. Therefore to enable only warning and error
+ * messages, use ORTP_WARNING | ORTP_ERROR. To disable logs, simply set loglevel to 0.
+ *
+ * @param loglevel A bitmask of the log levels to set.
+ */
+void linphone_core_set_log_level(OrtpLogLevel loglevel);
void linphone_core_enable_logs(FILE *file);
void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc);
void linphone_core_disable_logs(void);