Liblinphone: Logging

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

## 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
LinphoneLoggingService * | linphone_logging_service_get (void)
| Gets the singleton logging service object.
LinphoneLoggingService * | linphone_logging_service_ref (LinphoneLoggingService *log_service)
| Increases the reference counter.
void | linphone_logging_service_unref (LinphoneLoggingService *log_service)
| Decreases the reference counter and destroy the object if the counter reaches 0.
void | linphone_logging_service_add_callbacks (LinphoneLoggingService *log_service, LinphoneLoggingServiceCbs *cbs)
| Adds a callback object to the list of listeners.
void | linphone_logging_service_remove_callbacks (LinphoneLoggingService *log_service, LinphoneLoggingServiceCbs *cbs)
| Removes a callback object from the list of listeners.
LinphoneLoggingServiceCbs * | linphone_logging_service_get_current_callbacks (const LinphoneLoggingService *log_service)
| Returns the current callbacks being called while iterating on callbacks.
void | linphone_logging_service_set_log_level (LinphoneLoggingService *log_service, LinphoneLogLevel level)
| Set the verbosity of the log.
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.
unsigned int | linphone_logging_service_get_log_level_mask (const LinphoneLoggingService *log_service)
| Gets the log level mask.
void | linphone_logging_service_set_log_file (LinphoneLoggingService *log_service, const char *dir, const char *filename, size_t max_size)
| Enables logging in a file.
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()).
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()).
void | linphone_logging_service_debug (LinphoneLoggingService *log_service, const char *message)
| Write a LinphoneLogLevelDebug message to the logs.
void | linphone_logging_service_trace (LinphoneLoggingService *log_service, const char *message)
| Write a LinphoneLogLevelTrace message to the logs.
void | linphone_logging_service_message (LinphoneLoggingService *log_service, const char *message)
| Write a LinphoneLogLevelMessage message to the logs.
void | linphone_logging_service_warning (LinphoneLoggingService *log_service, const char *message)
| Write a LinphoneLogLevelWarning message to the logs.
void | linphone_logging_service_error (LinphoneLoggingService *log_service, const char *message)
| Write a LinphoneLogLevelError message to the logs.
void | linphone_logging_service_fatal (LinphoneLoggingService *log_service, const char *message)
| Write a LinphoneLogLevelFatal message to the logs.
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.
LinphoneLoggingServiceCbs * | linphone_logging_service_cbs_ref (LinphoneLoggingServiceCbs *cbs)
| Increases the reference counter.
void | linphone_logging_service_cbs_unref (LinphoneLoggingServiceCbs *cbs)
| Decreases the reference counter.
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.
LinphoneLoggingServiceCbsLogMessageWrittenCb | linphone_logging_service_cbs_get_log_message_written (const LinphoneLoggingServiceCbs *cbs)
| Gets the value of the message event callback.
void | linphone_logging_service_cbs_set_user_data (LinphoneLoggingServiceCbs *cbs, void *user_data)
| Pass a pointer on a custom object.
void * | linphone_logging_service_cbs_get_user_data (const LinphoneLoggingServiceCbs *cbs)
| Gets the user_data pointer back.
MS2_DEPRECATED LinphoneLoggingServiceCbs * | linphone_logging_service_get_callbacks (const LinphoneLoggingService *log_service)
| Gets the logging service listener.

## 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_service | A pointer on the logging service singleton.
  domain | A string describing which sub-library of liblinphone the message is coming from.
  level | Verbosity LinphoneLogLevel of the message.
  message | Content of the message.

## Enumeration Type Documentation

## ◆ _LinphoneLogLevel

enum _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_service | the LinphoneLoggingService object
  cbs | the 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

  cbs | the 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

  cbs | the 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

  cbs | the 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

  cbs | the LinphoneLoggingServiceCbs object.
  cb | the 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_callbacks() and linphone_logging_service_cbs_get_user_data().

Parameters

  cbs | the LinphoneLoggingServiceCbs object.
  user_data | the 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

  cbs | the 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_service | the LinphoneLoggingService object
  message | The 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_service | the LinphoneLoggingService object
  enable | if 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_service | the LinphoneLoggingService object
  message | The 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_service | the LinphoneLoggingService object
  message | The 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_service | the 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_service | the 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_service | the 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_service | the 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_service | the LinphoneLoggingService object
  message | The log message.

## ◆ linphone_logging_service_ref()

LinphoneLoggingService * linphone_logging_service_ref | ( | LinphoneLoggingService * | log_service | ) |

Increases the reference counter.

Parameters

  log_service | the 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_service | the LinphoneLoggingService object
  cbs | the 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_service | the LinphoneLoggingService object
  domain | The 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 | ( | 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_service | the LinphoneLoggingService object
  dir | Directory where to create the distinct parts of the log.
  filename | Name of the log file.
  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_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_service | the LinphoneLoggingService object
  level | the 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_service | the LinphoneLoggingService object
  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_logging_service_trace()

void linphone_logging_service_trace | ( | LinphoneLoggingService * | log_service,
|  | const char * | message )

Write a LinphoneLogLevelTrace message to the logs.

Parameters

  log_service | the LinphoneLoggingService object
  message | The 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_service | the 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_service | the LinphoneLoggingService object
  message | The log message.