Commit d61a62de authored by François Grisez's avatar François Grisez

Creates a new singleton object for logging features in the API of Liblinphone

parent fe7c1cec
......@@ -95,6 +95,7 @@ set(LINPHONE_SOURCE_FILES_C
linphonecore.c
linphone_tunnel_config.c
localplayer.c
logging.c
lpc2xml.c
lpconfig.c
lsd.c
......
......@@ -34,6 +34,11 @@
* @brief Initializing liblinphone.
**/
/**
* @defgroup logging Logging
* @brief Logging service of Linphone.
*/
/**
* @defgroup call_control Call control
* @brief Placing and receiving calls.
......
......@@ -21,7 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/core.h"
#include "linphone/sipsetup.h"
#include "linphone/lpconfig.h"
#include "linphone/logging.h"
#include "private.h"
#include "logging-private.h"
#include "quality_reporting.h"
#include "lime.h"
#include "conference_private.h"
......@@ -475,38 +477,17 @@ void linphone_core_set_log_file(FILE *file) {
}
void linphone_core_set_log_level(OrtpLogLevel loglevel) {
unsigned int mask = loglevel;
switch (loglevel) {
case ORTP_TRACE:
case ORTP_DEBUG:
mask |= ORTP_DEBUG;
BCTBX_NO_BREAK;
case ORTP_MESSAGE:
mask |= ORTP_MESSAGE;
BCTBX_NO_BREAK;
case ORTP_WARNING:
mask |= ORTP_WARNING;
BCTBX_NO_BREAK;
case ORTP_ERROR:
mask |= ORTP_ERROR;
BCTBX_NO_BREAK;
case ORTP_FATAL:
mask |= ORTP_FATAL;
break;
case ORTP_LOGLEV_END:
break;
}
linphone_core_set_log_level_mask(mask);
LinphoneLoggingService *log_service = linphone_logging_service_get();
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 loglevel) {
//we only have 2 domain for now ortp and belle-sip
bctbx_set_log_level_mask(ORTP_LOG_DOMAIN, loglevel);
bctbx_set_log_level_mask("bzrtp", loglevel); /*need something to set log lvel for all domains*/
sal_set_log_level((OrtpLogLevel)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) {
return bctbx_get_log_level_mask(ORTP_LOG_DOMAIN);
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;
......
/*
logging-private.h
Copyright (C) 2017 Belledonne Communications SARL
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _LOGGING_PRIVATE_H_
#define _LOGGING_PRIVATE_H_
#include <bctoolbox/logging.h>
#include "linphone/logging.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Converts a #BctbxLogLevel into #LinphoneLogLevel.
*/
LinphoneLogLevel _bctbx_log_level_to_linphone_log_level(BctbxLogLevel level);
/**
* @brief Converts a mask of #BctbxLogLevel into a mask of #LinphoneLogLevel.
*/
unsigned int _bctbx_log_mask_to_linphone_log_mask(unsigned int mask);
/**
* @brief Converts a #LinphoneLogLevel into #BctbxLogLevel.
*/
BctbxLogLevel _linphone_log_level_to_bctbx_log_level(LinphoneLogLevel level);
/**
* @brief Converts a mask of #LinphoneLogLevel into a mask of #BctbxLogLevel.
*/
unsigned int _linphone_log_mask_to_bctbx_log_mask(unsigned int mask);
/**
* @brief Releases the instance pointer of the singleton.
* @note You should not need to call this function since it is automatically done
* at process ending.
*/
void _linphone_logging_service_clean(void);
#ifdef __cplusplus
}
#endif
#endif // _LOGGING_PRIVATE_H_
/*
log.c
Copyright (C) 2017 Belledonne Communications SARL
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <map>
#include <algorithm>
#include <mediastreamer2/mscommon.h>
#include <belle-sip/object.h>
#include <bctoolbox/logging.h>
#include "linphone/logging.h"
#include "private.h"
#include "logging-private.h"
struct _LinphoneLoggingService {
belle_sip_object_t base;
LinphoneLoggingServiceCbs *cbs;
bctbx_log_handler_t *log_handler;
};
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneLoggingService);
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneLoggingService);
struct _LinphoneLoggingServiceCbs {
belle_sip_object_t base;
void *user_data;
LinphoneLoggingServiceCbsLogMessageWrittenCb message_event_cb;
};
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneLoggingServiceCbs);
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneLoggingServiceCbs);
static LinphoneLoggingServiceCbs *_linphone_logging_service_cbs_new(void);
static LinphoneLoggingService *_linphone_logging_service_instance = NULL;
static std::map<LinphoneLogLevel, BctbxLogLevel> _linphone_log_level_to_bctbx_log_level_map = {
{ LinphoneLogLevelDebug , BCTBX_LOG_DEBUG },
{ LinphoneLogLevelTrace , BCTBX_LOG_TRACE },
{ LinphoneLogLevelMessage , BCTBX_LOG_MESSAGE },
{ LinphoneLogLevelWarning , BCTBX_LOG_WARNING },
{ LinphoneLogLevelError , BCTBX_LOG_ERROR },
{ LinphoneLogLevelFatal , BCTBX_LOG_FATAL }
};
LinphoneLogLevel _bctbx_log_level_to_linphone_log_level(BctbxLogLevel level) {
auto &tmap = _linphone_log_level_to_bctbx_log_level_map;
auto predicate = [level](const std::pair<LinphoneLogLevel, BctbxLogLevel> &tuple)->bool{return tuple.second==level;};
auto response = std::find_if(tmap.cbegin(), tmap.cend(), predicate);
if (response != tmap.cend()) {
return response->first;
} else {
ms_fatal("%s(): invalid argurement [%d]", __FUNCTION__, level);
return LinphoneLogLevelDebug;
}
}
unsigned int _bctbx_log_mask_to_linphone_log_mask(unsigned int mask) {
unsigned int res = 0;
auto &tmap = _linphone_log_level_to_bctbx_log_level_map;
for (auto it=tmap.cbegin(); it!=tmap.cend(); it++) {
if (mask & it->second) {
mask&=~it->second;
res|=it->first;
}
}
if (mask != 0) {
ms_fatal("%s(): invalid flag set in mask [%x]", __FUNCTION__, mask);
}
return res;
}
BctbxLogLevel _linphone_log_level_to_bctbx_log_level(LinphoneLogLevel level) {
try {
return _linphone_log_level_to_bctbx_log_level_map.at(level);
} catch (const std::out_of_range &e) {
ms_fatal("%s(): invalid argument [%d]", __FUNCTION__, level);
return BCTBX_LOG_LOGLEV_END;
}
}
unsigned int _linphone_log_mask_to_bctbx_log_mask(unsigned int mask) {
unsigned int res = 0;
auto &tmap = _linphone_log_level_to_bctbx_log_level_map;
for (auto it=tmap.cbegin(); it!=tmap.cend(); it++) {
if (mask & it->first) {
mask&=~it->first;
res|=it->second;
}
}
if (mask != 0) {
ms_fatal("%s(): invalid flag set in mask [%x]", __FUNCTION__, mask);
}
return res;
}
static void _log_handler_on_message_written_cb(void *info,const char *domain, BctbxLogLevel lev, const char *fmt, va_list args) {
LinphoneLoggingService *service = (LinphoneLoggingService *)info;
if (service->cbs->message_event_cb) {
char *message = bctbx_strdup_vprintf(fmt, args);
service->cbs->message_event_cb(service, domain, _bctbx_log_level_to_linphone_log_level(lev), message);
bctbx_free(message);
}
}
static void _log_handler_destroy_cb(bctbx_log_handler_t *handler) {
LinphoneLoggingService *service = (LinphoneLoggingService *)bctbx_log_handler_get_user_data(handler);
service->log_handler = NULL;
}
static LinphoneLoggingService *_linphone_logging_service_new(void) {
LinphoneLoggingService *service = belle_sip_object_new(LinphoneLoggingService);
service->log_handler = bctbx_create_log_handler(_log_handler_on_message_written_cb, _log_handler_destroy_cb, service);
service->cbs = _linphone_logging_service_cbs_new();
bctbx_add_log_handler(service->log_handler);
return service;
}
LinphoneLoggingService *linphone_logging_service_get(void) {
if (_linphone_logging_service_instance == NULL) {
_linphone_logging_service_instance = _linphone_logging_service_new();
atexit(_linphone_logging_service_clean);
}
return _linphone_logging_service_instance;
}
void _linphone_logging_service_clean(void) {
if (_linphone_logging_service_instance) {
linphone_logging_service_unref(_linphone_logging_service_instance);
_linphone_logging_service_instance = NULL;
}
}
LinphoneLoggingService *linphone_logging_service_ref(LinphoneLoggingService *service) {
return (LinphoneLoggingService *)belle_sip_object_ref(service);
}
void linphone_logging_service_unref(LinphoneLoggingService *service) {
belle_sip_object_ref(service);
}
static void _linphone_logging_service_uninit(LinphoneLoggingService *log_service) {
if (log_service->log_handler) bctbx_remove_log_handler(log_service->log_handler);
linphone_logging_service_cbs_unref(log_service->cbs);
}
void linphone_logging_service_release_instance(void) {
if (_linphone_logging_service_instance) {
belle_sip_object_unref(BELLE_SIP_OBJECT(_linphone_logging_service_instance));
}
_linphone_logging_service_instance = NULL;
}
LinphoneLoggingServiceCbs *linphone_logging_service_get_callbacks(const LinphoneLoggingService *log_service) {
return log_service->cbs;
}
static const char *_linphone_logging_service_log_domains[] = {
ORTP_LOG_DOMAIN,
"bzrtp",
BELLE_SIP_LOG_DOMAIN,
NULL
};
void linphone_logging_service_set_log_level(LinphoneLoggingService *log_service, LinphoneLogLevel loglevel) {
const char **domain;
for (domain=_linphone_logging_service_log_domains; *domain; domain++) {
bctbx_set_log_level(*domain, _linphone_log_level_to_bctbx_log_level(loglevel));
}
}
void linphone_logging_service_set_log_level_mask(LinphoneLoggingService *log_service, unsigned int mask) {
const char **domain;
for (domain=_linphone_logging_service_log_domains; *domain; domain++) {
bctbx_set_log_level_mask(*domain, _linphone_log_mask_to_bctbx_log_mask(mask));
}
}
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));
}
void linphone_logging_service_set_log_file(const LinphoneLoggingService *service, const char *dir, const char *filename, size_t max_size) {
bctbx_log_handler_t *log_handler = bctbx_create_file_log_handler((uint64_t)max_size, dir, filename, NULL);
bctbx_add_log_handler(log_handler);
}
BELLE_SIP_INSTANCIATE_VPTR(LinphoneLoggingService, belle_sip_object_t,
_linphone_logging_service_uninit, // uninit
NULL, // clone
NULL, // marshal
FALSE // unown
);
static LinphoneLoggingServiceCbs *_linphone_logging_service_cbs_new(void) {
return belle_sip_object_new(LinphoneLoggingServiceCbs);
}
LinphoneLoggingServiceCbs *linphone_logging_service_cbs_ref(LinphoneLoggingServiceCbs *cbs) {
return (LinphoneLoggingServiceCbs *)belle_sip_object_ref(cbs);
}
void linphone_logging_service_cbs_unref(LinphoneLoggingServiceCbs *cbs) {
belle_sip_object_unref(cbs);
}
void linphone_logging_service_cbs_set_log_message_written(LinphoneLoggingServiceCbs *cbs, LinphoneLoggingServiceCbsLogMessageWrittenCb cb) {
cbs->message_event_cb = cb;
}
LinphoneLoggingServiceCbsLogMessageWrittenCb linphone_logging_service_cbs_get_log_message_written(const LinphoneLoggingServiceCbs *cbs) {
return cbs->message_event_cb;
}
void linphone_logging_service_cbs_set_user_data(LinphoneLoggingServiceCbs *cbs, void *user_data) {
cbs->user_data = user_data;
}
BELLE_SIP_INSTANCIATE_VPTR(LinphoneLoggingServiceCbs, belle_sip_object_t,
NULL, // uninit
NULL, // clone
NULL, // marshal
FALSE // unown
);
......@@ -1897,7 +1897,9 @@ BELLE_SIP_TYPE_ID(LinphonePlayer),
BELLE_SIP_TYPE_ID(LinphonePlayerCbs),
BELLE_SIP_TYPE_ID(LinphoneEventLog),
BELLE_SIP_TYPE_ID(LinphoneMessage),
BELLE_SIP_TYPE_ID(LinphoneMessageEvent)
BELLE_SIP_TYPE_ID(LinphoneMessageEvent),
BELLE_SIP_TYPE_ID(LinphoneLoggingService),
BELLE_SIP_TYPE_ID(LinphoneLoggingServiceCbs),
BELLE_SIP_DECLARE_TYPES_END
......
......@@ -48,6 +48,7 @@ set(HEADER_FILES
im_notif_policy.h
info_message.h
ldapprovider.h
logging.h
lpconfig.h
misc.h
nat_policy.h
......
......@@ -788,8 +788,9 @@ LINPHONE_PUBLIC void linphone_core_reset_log_collection(void);
* 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.
*/
LINPHONE_PUBLIC void linphone_core_set_log_handler(OrtpLogFunc logfunc);
LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_set_log_handler(OrtpLogFunc logfunc);
/**
* Define a log file.
......@@ -797,15 +798,17 @@ LINPHONE_PUBLIC void linphone_core_set_log_handler(OrtpLogFunc logfunc);
* 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.
* @deprecated Use #linphone_log_service_set_file() instead. Deprecated since 2017-10-10.
*/
LINPHONE_PUBLIC void linphone_core_set_log_file(FILE *file);
LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_set_log_file(FILE *file);
/**
* Define the minimum level for logging.
*
* @param loglevel Minimum level for logging messages.
* @deprecated Use #linphone_logging_service_set_log_level() instead. Deprecated since 2017-10-10.
**/
LINPHONE_PUBLIC void linphone_core_set_log_level(OrtpLogLevel loglevel);
LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_set_log_level(OrtpLogLevel loglevel);
/**
* Define the log level using mask.
......@@ -813,22 +816,25 @@ LINPHONE_PUBLIC void linphone_core_set_log_level(OrtpLogLevel loglevel);
* 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.
* @param mask A bitmask of the log levels to set.
* @deprecated Use #linphone_logging_service_set_log_level() instead. Deprecated since 2017-10-10.
*/
LINPHONE_PUBLIC void linphone_core_set_log_level_mask(unsigned int loglevel);
LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_set_log_level_mask(unsigned int mask);
/**
* Get defined log level mask.
*
* @return 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.
* @deprecated Use #linphone_logging_service_get_log_level_mask() instead. Deprecated since 2017-10-10.
*/
LINPHONE_PUBLIC unsigned int linphone_core_get_log_level_mask(void);
LINPHONE_PUBLIC LINPHONE_DEPRECATED unsigned int linphone_core_get_log_level_mask(void);
/**
* Enable logs in supplied FILE*.
* @param file a C FILE* where to fprintf logs. If null stdout is used.
* @deprecated Use #linphone_core_set_log_file and #linphone_core_set_log_level instead.
* @deprecated Use #linphone_core_set_log_file and #linphone_core_set_log_level() instead.
* Deprecated since 2017-01-12.
* @donotwrap
**/
LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_core_enable_logs(FILE *file);
......@@ -838,13 +844,14 @@ LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_core_enable_logs(FILE *file);
* @param logfunc The address of a OrtpLogFunc callback whose protoype is
* typedef void (*OrtpLogFunc)(OrtpLogLevel lev, const char *fmt, va_list args);
* @deprecated Use #linphone_core_set_log_handler and #linphone_core_set_log_level instead.
* Deprecated since 2017-01-12.
* @donotwrap
**/
LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc);
/**
* Entirely disable logging.
* @deprecated Use #linphone_core_set_log_level instead.
* @deprecated Use #linphone_core_set_log_level() instead. Deprecated since 2017-01-12.
* @donotwrap
**/
LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_core_disable_logs(void);
......
/*
logging.h
Copyright (C) 2017 Belledonne Communications SARL
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _LINPHONE_LOG_H_
#define _LINPHONE_LOG_H_
#include "types.h"
#include "defs.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup logging
* @{
*/
/**
* @brief Singleton class giving access to logging features.
*/
typedef struct _LinphoneLoggingService LinphoneLoggingService;
/**
* @brief Listener for #LinphoneLoggingService.
*/
typedef struct _LinphoneLoggingServiceCbs LinphoneLoggingServiceCbs;
/**
* @brief Verbosity levels of log messages.
*/
typedef enum _LinphoneLogLevel {
LinphoneLogLevelDebug = 1, /**< @brief Level for debug messages. */
LinphoneLogLevelTrace = 1<<1, /**< @brief Level for traces. */
LinphoneLogLevelMessage = 1<<2, /**< @brief Level for information messages. */
LinphoneLogLevelWarning = 1<<3, /**< @brief Level for warning messages. */
LinphoneLogLevelError = 1<<4, /**< @brief Level for error messages. */
LinphoneLogLevelFatal = 1<<5 /**< @brief Level for fatal error messages. */
} LinphoneLogLevel;
/**
* @brief Type of callbacks called each time liblinphone write a log message.
*
* @param log_service A pointer on the logging service singleton.
* @param domain A string describing which sub-library of liblinphone the message is coming from.
* @param lev Verbosity level of the message.
* @param message Content of the message.
*/
typedef void (*LinphoneLoggingServiceCbsLogMessageWrittenCb)(LinphoneLoggingService *log_service, const char *domain, LinphoneLogLevel lev, const char *message);
/**
* @brief Gets the singleton logging service object.
*
* The singleton is automatically instantiated if it hasn't
* been done yet.
*
* @return A pointer on the singleton.
*/
LINPHONE_PUBLIC LinphoneLoggingService *linphone_logging_service_get(void);
/**
* @brief Increases the reference counter.
*/
LINPHONE_PUBLIC LinphoneLoggingService *linphone_logging_service_ref(LinphoneLoggingService *service);
/**
* @brief Decreases the reference counter and destroy the object
* if the counter reaches 0.
*/
LINPHONE_PUBLIC void linphone_logging_service_unref(LinphoneLoggingService *service);
/**
* @brief Gets the logging service listener.
*/
LINPHONE_PUBLIC LinphoneLoggingServiceCbs *linphone_logging_service_get_callbacks(const LinphoneLoggingService *log_service);
/**
* @brief Set the verbosity of the log.
*
* For instance, a level of #LinphoneLogLevelMessage will let pass fatal, error, warning and message-typed messages
* whereas trace and debug messages will be dumped out.
*/
LINPHONE_PUBLIC void linphone_logging_service_set_log_level(LinphoneLoggingService *log_service, LinphoneLogLevel level);
/**
* @brief Sets the types of messages that will be authorized to be written in the log.
* @param log_service The logging service singleton.
* @param mask Example: #LinphoneLogLevelMessage|#LinphoneLogLevelError will ONLY let pass message-typed and error messages.
* @note Calling that function reset the log level that has been specified by #linphone_logging_service_set_log_level().
*/
LINPHONE_PUBLIC void linphone_logging_service_set_log_level_mask(LinphoneLoggingService *log_service, unsigned int mask);
/**
* @brief Gets the log level mask.
*/
LINPHONE_PUBLIC unsigned int linphone_logging_service_get_log_level_mask(const LinphoneLoggingService *log_service);
/**
* @brief Enables logging in a file.
*
* That function enables an internal log handler that writes log messages in
* log-rotated files.
*
* @param dir Directory where to create the distinct parts of the log.
* @param filename Name of the log file.
* @param max_size The maximal size of each part of the log. The log rotating is triggered
* each time the currently opened log part reach that limit.
*/
LINPHONE_PUBLIC void linphone_logging_service_set_log_file(const LinphoneLoggingService *service, const char *dir, const char *filename, size_t max_size);
/**
* @brief Increases the reference counter.
*/
LINPHONE_PUBLIC LinphoneLoggingServiceCbs *linphone_logging_service_cbs_ref(LinphoneLoggingServiceCbs *cbs);
/**
* @brief Decreases the reference counter.
*
* The object is automatically destroyed once the counter reach 0.
*/
LINPHONE_PUBLIC void linphone_logging_service_cbs_unref(LinphoneLoggingServiceCbs *cbs);
/**
* @brief Sets the callback to call each time liblinphone writes a log message.
*/
LINPHONE_PUBLIC void linphone_logging_service_cbs_set_log_message_written(LinphoneLoggingServiceCbs *cbs, LinphoneLoggingServiceCbsLogMessageWrittenCb cb);
/**
* @brief Gets the value of the message event callback.
*/
LINPHONE_PUBLIC LinphoneLoggingServiceCbsLogMessageWrittenCb linphone_logging_service_cbs_get_log_message_written(const LinphoneLoggingServiceCbs *cbs);
/**
* @brief Pass a pointer on a custom object.
*
* That pointer can be get back by callbacks by using #linphone_logging_service_get_cbs() and #linphone_logging_service_cbs_get_user_data().
*/
LINPHONE_PUBLIC void linphone_logging_service_cbs_set_user_data(LinphoneLoggingServiceCbs *cbs, void *user_data);
/**
* @brief Gets the user_data pointer back.
*/
LINPHONE_PUBLIC void *linphone_logging_service_cbs_get_user_data(const LinphoneLoggingServiceCbs *cbs);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif // _LINPHONE_LOG_H_
......@@ -19,7 +19,9 @@
#include <stdio.h>
#include <stdlib.h>
#include "linphone/core.h"
#include "linphone/logging.h"
#include "private.h"
#include "logging-private.h"
#include "liblinphone_tester.h"
#include <bctoolbox/tester.h>
......@@ -475,7 +477,7 @@ void linphone_core_manager_uninit(LinphoneCoreManager *mgr) {
}
manager_count--;
linphone_core_set_log_level(old_log_level);
linphone_core_set_log_level_mask(old_log_level);
}
void linphone_core_manager_wait_for_stun_resolution(LinphoneCoreManager *mgr) {
......
......@@ -292,7 +292,7 @@ class EnumValue(DocumentableObject):
self.value = None
def value_from_string(self, stringValue):
m = re.match('^1\s*<<\s*([0-9]+)$', stringValue)
m = re.match('^\s*1\s*<<\s*([0-9]+)$', stringValue)
if m is not None:
self.value = Flag(int(m.group(1)))
else:
......
......@@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <linphone/linphone_tunnel.h>
#include <linphone/linphonecore_utils.h>
#include <linphone/wrapper_utils.h>
#include <linphone/logging.h>
#include "linphone++/linphone.hh"
#include "tools.hh"
......
......@@ -685,7 +685,7 @@ class GenWrapper(object):
self.parser = AbsApi.CParser(project)
self.parser.parse_all()
self.translator = CppTranslator()
self.renderer = pystache.Renderer()
self.renderer = pystache.Renderer()
self.mainHeader = MainHeader()
self.impl = ClassImpl()
......
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