LogControl

public class LogControl
extension LogControl: NativeBase
extension LogControl: Hashable

This class provides functionality to enable/disable console logs as well as setting a custom log appender to receive log messages from the SDK.

  • Invalid file path exception.

    Declaration

    Swift

    public typealias InvalidPathError = String
  • Enables SDK logging messages to console that can be viewed using macOS Console app. Enabled by default with LogLevel.logLevelInfo.

    Declaration

    Swift

    public static func enableLoggingToConsole(level: LogLevel)

    Parameters

    level

    Log level.

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

    Declaration

    Swift

    public static func disableLoggingToConsole()
  • 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 LogControl.disableLoggingToConsole(...) API.

    Declaration

    Swift

    public static func setAppender(level: LogLevel, appender: LogAppender)

    Parameters

    level

    Log level.

    appender

    New log appender.

  • 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 LogControl.disableLoggingToConsole(...) API.

    Throws

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

    Declaration

    Swift

    public static func setAppender(level: LogLevel, path: String) throws

    Parameters

    level

    Log level.

    path

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

  • Removes previously added custom log appender.

    Declaration

    Swift

    public static func removeAppender()