Class LogControl


  • public final class LogControl
    extends NativeBase

    This class provides functionality to enable/disable console logs as well as setting a custom log appender to receive log messages from the SDK. Note, this class will load native libraries of SDK, therefore generally it should be used just before SDK initialization, otherwise, it might have an unexpected performance impact if called not at the right time.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void disableLoggingToConsole()
      Disables SDK logging messages to console.
      static void enableLoggingToConsole​(LogLevel level)
      Enables SDK logging messages to console that can be viewed using logcat tool.
      static void removeAppender()
      Removes previously added custom log appender.
      static void setAppender​(LogLevel level, LogAppender appender)
      Sets a custom log appender to receive log messages from the SDK.
      static void setAppender​(LogLevel level, java.lang.String path)
      Sets a custom log appender that will write SDK log messages to a file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • enableLoggingToConsole

        public static void enableLoggingToConsole​(@NonNull
                                                  LogLevel level)

        Enables SDK logging messages to console that can be viewed using logcat tool. Enabled by default with LogLevel.LOG_LEVEL_INFO.

        Parameters:
        level -

        Log level.

      • disableLoggingToConsole

        public static void disableLoggingToConsole()

        Disables SDK logging messages to console. Enabled by default with LogLevel.LOG_LEVEL_INFO.

      • setAppender

        public static void setAppender​(@NonNull
                                       LogLevel level,
                                       @NonNull
                                       LogAppender appender)

        Sets a custom log appender to receive log messages from the SDK. This overwrites a previous custom log appender set by user. Note, that setting the custom appender does not disable logging to the console made by SDK, in order to do that use disableLoggingToConsole() API.

        Parameters:
        level -

        Log level.

        appender -

        New log appender.

      • setAppender

        public static void setAppender​(@NonNull
                                       LogLevel level,
                                       @NonNull
                                       java.lang.String path)
                                throws LogControl.InvalidPathException

        Sets a custom log appender that will write SDK log messages to a file. This overwrites a previous custom log appender set by user. Note, that setting the custom appender does not disable logging to the console made by SDK, in order to do that use disableLoggingToConsole() API.

        Parameters:
        level -

        Log level.

        path -

        Absolute path to a file that the application has read/write permissions.

        Throws:
        LogControl.InvalidPathException -

        LogControl.InvalidPathException Indicates that the file path is invalid or not writeable.

      • removeAppender

        public static void removeAppender()

        Removes previously added custom log appender.