Package org.linphone.core

# Interface LoggingService

public interface LoggingService
Singleton class giving access to logging features.
It supports custom domain, writing into a file as well as several verbosity
levels. The `LoggingServiceListener` listener allows you to be notified
each time a log is printed.
As the `LoggingService` is a singleton, use `get()` to get it.

## Method Summary

Modifier and Type
Method
Description
`void`
`addListener(LoggingServiceListener listener)`
`void`
`debug(String message)`
Write a LinphoneLogLevelDebug message to the logs.
`void`
`error(String message)`
Write a LinphoneLogLevelError message to the logs.
`void`
`fatal(String message)`
Write a LinphoneLogLevelFatal message to the logs.
`LoggingService`
`get()`
Gets the singleton logging service object.
`String`
`getDomain()`
Get the domain where application logs are written (for example with `message(java.lang.String)`
).
`int`
`getLogLevelMask()`
Gets the log level mask.
`long`
`getNativePointer()`
Gets the native pointer used by this class to make native method calls.
`Object`
`getUserData()`
Gets the object stored in this object user's data
`void`
`message(String message)`
Write a LinphoneLogLevelMessage message to the logs.
`void`
`removeListener(LoggingServiceListener listener)`
`void`
`setDomain(String domain)`
Set the domain where application logs are written (for example with `message(java.lang.String)`
).
`void`
`setLogFile(String dir, String filename, int maxSize)`
Enables logging in a file.
`void`
`setLogLevel(LogLevel level)`
Set the verbosity of the log.
`void`
`setLogLevelMask(int mask)`
Sets the types of messages that will be authorized to be written in the log.
`void`
`setStackTraceDumpsEnabled(boolean enable)`
Allow Linphone to set handlers for catching exceptions and write the stack
trace into log.
`void`
`setUserData(Object data)`
Sets the object to store in this object user's data
`String`
`toString()`
`void`
`trace(String message)`
Write a LinphoneLogLevelTrace message to the logs.
`void`
`warning(String message)`
Write a LinphoneLogLevelWarning message to the logs.

## Method Details

### getDomain

@Nullable String getDomain()
Get the domain where application logs are written (for example with `message(java.lang.String)`
).

Returns:
  The domain where application logs are written.

### setDomain

void setDomain(@Nullable String domain)
Set the domain where application logs are written (for example with `message(java.lang.String)`
).

Parameters:
  `domain` - The domain.
  note: The domain is mandatory to write logs. This needs to be set before
  setting the log level.

### setLogLevel

void setLogLevel(LogLevel level)
Set the verbosity of the log.
For instance, a level of `LogLevel.Message` will let pass fatal, error,
warning and message-typed messages whereas trace and debug messages will be
dumped out.

Parameters:
  `level` - the `LogLevel` to set

### getLogLevelMask

int getLogLevelMask()
Gets the log level mask.

Returns:
  the log level mask

### setLogLevelMask

void setLogLevelMask(int mask)
Sets the types of messages that will be authorized to be written in the log.

Parameters:
  `mask` - Example: `LogLevel.Message`|`LogLevel.Error` will ONLY
  let pass message-typed and error messages.
  note: Calling that function reset the log level that has been specified by
  `setLogLevel(org.linphone.core.LogLevel)`.

### setStackTraceDumpsEnabled

void setStackTraceDumpsEnabled(boolean enable)
Allow Linphone to set handlers for catching exceptions and write the stack
trace into log.
Available for Windows. It keeps old handlers.

Parameters:
  `enable` - if true global handlers will be prepend by the logger handlers.
  By default, it is false.

### debug

void debug(@NonNull String message)
Write a LinphoneLogLevelDebug message to the logs.

Parameters:
  `message` - The log message.

### error

void error(@NonNull String message)
Write a LinphoneLogLevelError message to the logs.

Parameters:
  `message` - The log message.

### fatal

void fatal(@NonNull String message)
Write a LinphoneLogLevelFatal message to the logs.

Parameters:
  `message` - The log message.

### message

void message(@NonNull String message)
Write a LinphoneLogLevelMessage message to the logs.

Parameters:
  `message` - The log message.

### setLogFile

void setLogFile(@NonNull String dir, @NonNull String filename, int maxSize)
Enables logging in a file.
This function enables an internal log handler that writes log messages to
log-rotated files.

Parameters:
  `dir` - Directory where to create the distinct parts of the log.
  `filename` - Name of the log file.
  `maxSize` - The maximal size of each part of the log. The log rotating is
  triggered each time the currently opened log part reach that limit.

### trace

void trace(@NonNull String message)
Write a LinphoneLogLevelTrace message to the logs.

Parameters:
  `message` - The log message.

### warning

void warning(@NonNull String message)
Write a LinphoneLogLevelWarning message to the logs.

Parameters:
  `message` - The log message.

### get

@NonNull LoggingService get()
Gets the singleton logging service object.
The singleton is automatically instantiated if it hasn't been done yet.

Returns:
  A pointer on the `LoggingService` singleton.

### addListener

void addListener(LoggingServiceListener listener)

### removeListener

void removeListener(LoggingServiceListener listener)

### setUserData

void setUserData(Object data)
Sets the object to store in this object user's data

Parameters:
  `data` - the object to store

### getUserData

Object getUserData()
Gets the object stored in this object user's data

Returns:
  the object store if any, null otherwise

### getNativePointer

long getNativePointer()
Gets the native pointer used by this class to make native method calls.

Returns:
  the nativer pointer, as long

### toString

String toString()

Overrides:
  `toString` in class `Object`