Liblinphone  5.3.0
Typedefs | Enumerations | Functions
Logging

Logging service of Linphone. More...

Typedefs

typedef struct _LinphoneLoggingService LinphoneLoggingService
 Singleton class giving access to logging features. More...
 
typedef struct _LinphoneLoggingServiceCbs LinphoneLoggingServiceCbs
 Listener for LinphoneLoggingService.
 
typedef enum _LinphoneLogLevel LinphoneLogLevel
 Verbosity levels of log messages.
 
typedef void(* LinphoneLoggingServiceCbsLogMessageWrittenCb) (LinphoneLoggingService *log_service, const char *domain, LinphoneLogLevel level, const char *message)
 Type of callbacks called each time liblinphone write a log message. More...
 

Enumerations

enum  _LinphoneLogLevel {
  LinphoneLogLevelDebug = 1 << 0,
  LinphoneLogLevelTrace = 1 << 1,
  LinphoneLogLevelMessage = 1 << 2,
  LinphoneLogLevelWarning = 1 << 3,
  LinphoneLogLevelError = 1 << 4,
  LinphoneLogLevelFatal = 1 << 5
}
 Verbosity levels of log messages. More...
 

Functions

LinphoneLoggingServicelinphone_logging_service_get (void)
 Gets the singleton logging service object. More...
 
LinphoneLoggingServicelinphone_logging_service_ref (LinphoneLoggingService *log_service)
 Increases the reference counter. More...
 
void linphone_logging_service_unref (LinphoneLoggingService *log_service)
 Decreases the reference counter and destroy the object if the counter reaches 0. More...
 
void linphone_logging_service_add_callbacks (LinphoneLoggingService *log_service, LinphoneLoggingServiceCbs *cbs)
 Adds a callback object to the list of listeners. More...
 
void linphone_logging_service_remove_callbacks (LinphoneLoggingService *log_service, LinphoneLoggingServiceCbs *cbs)
 Removes a callback object from the list of listeners. More...
 
LinphoneLoggingServiceCbslinphone_logging_service_get_current_callbacks (const LinphoneLoggingService *log_service)
 Returns the current callbacks being called while iterating on callbacks. More...
 
void linphone_logging_service_set_log_level (LinphoneLoggingService *log_service, LinphoneLogLevel level)
 Set the verbosity of the log. More...
 
void linphone_logging_service_set_log_level_mask (LinphoneLoggingService *log_service, unsigned int mask)
 Sets the types of messages that will be authorized to be written in the log. More...
 
unsigned int linphone_logging_service_get_log_level_mask (const LinphoneLoggingService *log_service)
 Gets the log level mask. More...
 
void linphone_logging_service_set_log_file (const LinphoneLoggingService *log_service, const char *dir, const char *filename, size_t max_size)
 Enables logging in a file. More...
 
void linphone_logging_service_set_domain (LinphoneLoggingService *log_service, const char *domain)
 Set the domain where application logs are written (for example with linphone_logging_service_message()). More...
 
const char * linphone_logging_service_get_domain (LinphoneLoggingService *log_service)
 Get the domain where application logs are written (for example with linphone_logging_service_message()). More...
 
void linphone_logging_service_debug (LinphoneLoggingService *log_service, const char *message)
 Write a LinphoneLogLevelDebug message to the logs. More...
 
void linphone_logging_service_trace (LinphoneLoggingService *log_service, const char *message)
 Write a LinphoneLogLevelTrace message to the logs. More...
 
void linphone_logging_service_message (LinphoneLoggingService *log_service, const char *message)
 Write a LinphoneLogLevelMessage message to the logs. More...
 
void linphone_logging_service_warning (LinphoneLoggingService *log_service, const char *message)
 Write a LinphoneLogLevelWarning message to the logs. More...
 
void linphone_logging_service_error (LinphoneLoggingService *log_service, const char *message)
 Write a LinphoneLogLevelError message to the logs. More...
 
void linphone_logging_service_fatal (LinphoneLoggingService *log_service, const char *message)
 Write a LinphoneLogLevelFatal message to the logs. More...
 
void linphone_logging_service_enable_stack_trace_dumps (LinphoneLoggingService *log_service, bool_t enable)
 Allow Linphone to set handlers for catching exceptions and write the stack trace into log. More...
 
LinphoneLoggingServiceCbslinphone_logging_service_cbs_ref (LinphoneLoggingServiceCbs *cbs)
 Increases the reference counter. More...
 
void linphone_logging_service_cbs_unref (LinphoneLoggingServiceCbs *cbs)
 Decreases the reference counter. More...
 
void linphone_logging_service_cbs_set_log_message_written (LinphoneLoggingServiceCbs *cbs, LinphoneLoggingServiceCbsLogMessageWrittenCb cb)
 Sets the callback to call each time liblinphone writes a log message. More...
 
LinphoneLoggingServiceCbsLogMessageWrittenCb linphone_logging_service_cbs_get_log_message_written (const LinphoneLoggingServiceCbs *cbs)
 Gets the value of the message event callback. More...
 
void linphone_logging_service_cbs_set_user_data (LinphoneLoggingServiceCbs *cbs, void *user_data)
 Pass a pointer on a custom object. More...
 
void * linphone_logging_service_cbs_get_user_data (const LinphoneLoggingServiceCbs *cbs)
 Gets the user_data pointer back. More...
 
MS2_DEPRECATED LinphoneLoggingServiceCbslinphone_logging_service_get_callbacks (const LinphoneLoggingService *log_service)
 Gets the logging service listener. More...
 

Detailed Description

Logging service of Linphone.

Typedef Documentation

◆ LinphoneLoggingService

typedef struct _LinphoneLoggingService LinphoneLoggingService

Singleton class giving access to logging features.

It supports custom domain, writing into a file as well as several verbosity levels. The LinphoneLoggingServiceCbs listener allows you to be notified each time a log is printed.

As the LinphoneLoggingService is a singleton, use linphone_logging_service_get() to get it.

◆ LinphoneLoggingServiceCbsLogMessageWrittenCb

typedef void(* LinphoneLoggingServiceCbsLogMessageWrittenCb) (LinphoneLoggingService *log_service, const char *domain, LinphoneLogLevel level, const char *message)

Type of callbacks called each time liblinphone write a log message.

Parameters
log_serviceA pointer on the logging service singleton.
domainA string describing which sub-library of liblinphone the message is coming from.
levelVerbosity LinphoneLogLevel of the message.
messageContent of the message.

Enumeration Type Documentation

◆ _LinphoneLogLevel

Verbosity levels of log messages.

Enumerator
LinphoneLogLevelDebug 

Level for debug messages.

LinphoneLogLevelTrace 

Level for traces.

LinphoneLogLevelMessage 

Level for information messages.

LinphoneLogLevelWarning 

Level for warning messages.

LinphoneLogLevelError 

Level for error messages.

LinphoneLogLevelFatal 

Level for fatal error messages.

Function Documentation

◆ linphone_logging_service_add_callbacks()

void linphone_logging_service_add_callbacks ( LinphoneLoggingService log_service,
LinphoneLoggingServiceCbs cbs 
)

Adds a callback object to the list of listeners.

Parameters
log_servicethe LinphoneLoggingService object
cbsthe LinphoneLoggingServiceCbs to add

◆ linphone_logging_service_cbs_get_log_message_written()

LinphoneLoggingServiceCbsLogMessageWrittenCb linphone_logging_service_cbs_get_log_message_written ( const LinphoneLoggingServiceCbs cbs)

Gets the value of the message event callback.

Parameters
cbsthe LinphoneLoggingServiceCbs object.
Returns
the current LinphoneLoggingServiceCbsLogMessageWrittenCb

◆ linphone_logging_service_cbs_get_user_data()

void* linphone_logging_service_cbs_get_user_data ( const LinphoneLoggingServiceCbs cbs)

Gets the user_data pointer back.

Parameters
cbsthe LinphoneLoggingServiceCbs object.
Returns
the user data pointer.

◆ linphone_logging_service_cbs_ref()

LinphoneLoggingServiceCbs* linphone_logging_service_cbs_ref ( LinphoneLoggingServiceCbs cbs)

Increases the reference counter.

Parameters
cbsthe LinphoneLoggingServiceCbs object.
Returns
the same LinphoneLoggingServiceCbs object

◆ linphone_logging_service_cbs_set_log_message_written()

void linphone_logging_service_cbs_set_log_message_written ( LinphoneLoggingServiceCbs cbs,
LinphoneLoggingServiceCbsLogMessageWrittenCb  cb 
)

Sets the callback to call each time liblinphone writes a log message.

Parameters
cbsthe LinphoneLoggingServiceCbs object.
cbthe LinphoneLoggingServiceCbsLogMessageWrittenCb to set

◆ linphone_logging_service_cbs_set_user_data()

void linphone_logging_service_cbs_set_user_data ( LinphoneLoggingServiceCbs cbs,
void *  user_data 
)

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().

Parameters
cbsthe LinphoneLoggingServiceCbs object.
user_datathe user data pointer.

◆ linphone_logging_service_cbs_unref()

void linphone_logging_service_cbs_unref ( LinphoneLoggingServiceCbs cbs)

Decreases the reference counter.

The object is automatically destroyed once the counter reach 0.

Parameters
cbsthe LinphoneLoggingServiceCbs object.

◆ linphone_logging_service_debug()

void linphone_logging_service_debug ( LinphoneLoggingService log_service,
const char *  message 
)

Write a LinphoneLogLevelDebug message to the logs.

Parameters
log_servicethe LinphoneLoggingService object
messageThe log message.

◆ linphone_logging_service_enable_stack_trace_dumps()

void linphone_logging_service_enable_stack_trace_dumps ( LinphoneLoggingService log_service,
bool_t  enable 
)

Allow Linphone to set handlers for catching exceptions and write the stack trace into log.

Available for Windows. It keeps old handlers.

Parameters
log_servicethe LinphoneLoggingService object
enableif TRUE global handlers will be prepend by the logger handlers. By default, it is FALSE.

◆ linphone_logging_service_error()

void linphone_logging_service_error ( LinphoneLoggingService log_service,
const char *  message 
)

Write a LinphoneLogLevelError message to the logs.

Parameters
log_servicethe LinphoneLoggingService object
messageThe log message.

◆ linphone_logging_service_fatal()

void linphone_logging_service_fatal ( LinphoneLoggingService log_service,
const char *  message 
)

Write a LinphoneLogLevelFatal message to the logs.

Parameters
log_servicethe LinphoneLoggingService object
messageThe log message.

◆ linphone_logging_service_get()

LinphoneLoggingService* linphone_logging_service_get ( void  )

Gets the singleton logging service object.

The singleton is automatically instantiated if it hasn't been done yet.

Returns
A pointer on the LinphoneLoggingService singleton.

◆ linphone_logging_service_get_callbacks()

MS2_DEPRECATED LinphoneLoggingServiceCbs* linphone_logging_service_get_callbacks ( const LinphoneLoggingService log_service)

Gets the logging service listener.

Parameters
log_servicethe LinphoneLoggingService object
Deprecated:
19/02/2019 Use add_callbacks / remove_callbacks instead

◆ linphone_logging_service_get_current_callbacks()

LinphoneLoggingServiceCbs* linphone_logging_service_get_current_callbacks ( const LinphoneLoggingService log_service)

Returns the current callbacks being called while iterating on callbacks.

Parameters
log_servicethe LinphoneLoggingService object
Returns
A pointer to the current LinphoneLoggingServiceCbs object

◆ linphone_logging_service_get_domain()

const char* linphone_logging_service_get_domain ( LinphoneLoggingService log_service)

Get the domain where application logs are written (for example with linphone_logging_service_message()).

Parameters
log_servicethe LinphoneLoggingService object
Returns
The domain where application logs are written.

◆ linphone_logging_service_get_log_level_mask()

unsigned int linphone_logging_service_get_log_level_mask ( const LinphoneLoggingService log_service)

Gets the log level mask.

Parameters
log_servicethe LinphoneLoggingService object
Returns
the log level mask

◆ linphone_logging_service_message()

void linphone_logging_service_message ( LinphoneLoggingService log_service,
const char *  message 
)

Write a LinphoneLogLevelMessage message to the logs.

Parameters
log_servicethe LinphoneLoggingService object
messageThe log message.

◆ linphone_logging_service_ref()

LinphoneLoggingService* linphone_logging_service_ref ( LinphoneLoggingService log_service)

Increases the reference counter.

Parameters
log_servicethe LinphoneLoggingService object
Returns
the same LinphoneLoggingService object

◆ linphone_logging_service_remove_callbacks()

void linphone_logging_service_remove_callbacks ( LinphoneLoggingService log_service,
LinphoneLoggingServiceCbs cbs 
)

Removes a callback object from the list of listeners.

Parameters
log_servicethe LinphoneLoggingService object
cbsthe LinphoneLoggingServiceCbs to remove

◆ linphone_logging_service_set_domain()

void linphone_logging_service_set_domain ( LinphoneLoggingService log_service,
const char *  domain 
)

Set the domain where application logs are written (for example with linphone_logging_service_message()).

Parameters
log_servicethe LinphoneLoggingService object
domainThe domain.
Note
The domain is mandatory to write logs. This needs to be set before setting the log level.

◆ linphone_logging_service_set_log_file()

void linphone_logging_service_set_log_file ( const LinphoneLoggingService log_service,
const char *  dir,
const char *  filename,
size_t  max_size 
)

Enables logging in a file.

That function enables an internal log handler that writes log messages in log-rotated files.

Parameters
log_servicethe LinphoneLoggingService object
dirDirectory where to create the distinct parts of the log.
filenameName of the log file.
max_sizeThe maximal size of each part of the log. The log rotating is triggered each time the currently opened log part reach that limit.

◆ linphone_logging_service_set_log_level()

void linphone_logging_service_set_log_level ( LinphoneLoggingService log_service,
LinphoneLogLevel  level 
)

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.

Parameters
log_servicethe LinphoneLoggingService object
levelthe LinphoneLogLevel to set

◆ linphone_logging_service_set_log_level_mask()

void linphone_logging_service_set_log_level_mask ( LinphoneLoggingService log_service,
unsigned int  mask 
)

Sets the types of messages that will be authorized to be written in the log.

Parameters
log_servicethe LinphoneLoggingService object
maskExample: 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_logging_service_trace()

void linphone_logging_service_trace ( LinphoneLoggingService log_service,
const char *  message 
)

Write a LinphoneLogLevelTrace message to the logs.

Parameters
log_servicethe LinphoneLoggingService object
messageThe log message.

◆ linphone_logging_service_unref()

void linphone_logging_service_unref ( LinphoneLoggingService log_service)

Decreases the reference counter and destroy the object if the counter reaches 0.

Parameters
log_servicethe LinphoneLoggingService object

◆ linphone_logging_service_warning()

void linphone_logging_service_warning ( LinphoneLoggingService log_service,
const char *  message 
)

Write a LinphoneLogLevelWarning message to the logs.

Parameters
log_servicethe LinphoneLoggingService object
messageThe log message.