Commit 84a8e169 authored by Simon Morlat's avatar Simon Morlat
Browse files

Fix logging facility. Liblinphone outputs in the "liblinphone" log domain,...

Fix logging facility. Liblinphone outputs in the "liblinphone" log domain, mediastreamer and ortp have now their own log domains too.
parent e5ee11ec
......@@ -142,6 +142,7 @@ bc_git_version(liblinphone ${PROJECT_VERSION})
add_definitions(
-DUSE_BELLESIP
-DLIBLINPHONE_EXPORTS
-DBCTBX_LOG_DOMAIN="liblinphone"
)
set(LIBS
......
......@@ -506,14 +506,17 @@ void linphone_core_set_log_level(OrtpLogLevel loglevel) {
linphone_logging_service_set_log_level(log_service, _bctbx_log_level_to_linphone_log_level(loglevel));
}
void linphone_core_set_log_level_mask(unsigned int mask) {
LinphoneLoggingService *log_service = linphone_logging_service_get();
linphone_logging_service_set_log_level_mask(log_service, _bctbx_log_mask_to_linphone_log_mask(mask));
}
unsigned int linphone_core_get_log_level_mask(void) {
LinphoneLoggingService *log_service = linphone_logging_service_get();
return linphone_logging_service_get_log_level_mask(log_service);
}
static int _open_log_collection_file_with_idx(int idx) {
struct stat statbuf;
char *log_filename;
......@@ -616,8 +619,8 @@ static void linphone_core_log_collection_handler(const char *domain, OrtpLogLeve
}
if (liblinphone_log_collection_file) {
ortp_mutex_lock(&liblinphone_log_collection_mutex);
ret = fprintf(liblinphone_log_collection_file,"%i-%.2i-%.2i %.2i:%.2i:%.2i:%.3i %s %s\n",
1900 + lt->tm_year, lt->tm_mon + 1, lt->tm_mday, lt->tm_hour, lt->tm_min, lt->tm_sec, (int)(tp.tv_usec / 1000), lname, msg);
ret = fprintf(liblinphone_log_collection_file,"%i-%.2i-%.2i %.2i:%.2i:%.2i:%.3i [%s] %s %s\n",
1900 + lt->tm_year, lt->tm_mon + 1, lt->tm_mday, lt->tm_hour, lt->tm_min, lt->tm_sec, (int)(tp.tv_usec / 1000), domain, lname, msg);
fflush(liblinphone_log_collection_file);
if (ret > 0) {
liblinphone_log_collection_file_size += (size_t)ret;
......
......@@ -202,7 +202,7 @@ void linphone_logging_service_set_log_level_mask(LinphoneLoggingService *log_ser
}
unsigned int linphone_logging_service_get_log_level_mask(const LinphoneLoggingService *log_service) {
return _bctbx_log_mask_to_linphone_log_mask(bctbx_get_log_level_mask(ORTP_LOG_DOMAIN));
return _bctbx_log_mask_to_linphone_log_mask(bctbx_get_log_level_mask(BCTBX_LOG_DOMAIN));
}
void linphone_logging_service_set_log_file(const LinphoneLoggingService *service, const char *dir, const char *filename, size_t max_size) {
......
......@@ -148,7 +148,7 @@ static void log_handler(int lev, const char *fmt, va_list args) {
#endif
va_end(cap);
#endif
bctbx_logv(ORTP_LOG_DOMAIN, lev, fmt, args);
bctbx_logv(BCTBX_LOG_DOMAIN, lev, fmt, args);
}
void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, va_list args)) {
......
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