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 HERE SDK. The severity hierarchy used by these APIs is described in LogLevel. Use LogAppender to further customize log handling at runtime after the configured HERE SDK threshold has been applied.

  • Invalid file path exception.

    Declaration

    Swift

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

    Setting a LogLevel defines the minimal level of messages which will be reported, based on the following hierarchy:

    1. LOG_LEVEL_INFO
    2. LOG_LEVEL_WARNING
    3. LOG_LEVEL_ERROR
    4. LOG_LEVEL_FATAL

    For example, when setting LOG_LEVEL_ERROR, then LOG_LEVEL_INFO and LOG_LEVEL_WARNING will be excluded from the logs. All other levels will be logged. Therefore, only one call is needed. Another call will overwrite the previous minimal level. See LogLevel for the severity hierarchy and threshold behavior used by all HERE SDK logging APIs. Use LogAppender if you need to apply additional runtime filtering after this threshold.

    Declaration

    Swift

    public static func enableLoggingToConsole(level: LogLevel)

    Parameters

    level

    Log level.

  • Disables HERE 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 HERE SDK. This overwrites a previous custom log appender set by user. Note, that setting a custom appender does not disable logging to the console made by the HERE SDK, in order to do that use the LogControl.disableLoggingToConsole(...) API. To receive log messages emitted during HERE SDK initialization, set the custom appender before creating the SDK engine. Setting it later still affects subsequent log messages. The passed level is the minimal threshold. The provided LogAppender can apply additional runtime filtering or routing after that threshold has been applied.

    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 HERE SDK log messages to a file. This overwrites a previous custom log appender set by user. Note, that setting a custom appender does not disable logging to the console made by the HERE SDK, in order to do that use the LogControl.disableLoggingToConsole(...) API. To receive log messages emitted during HERE SDK initialization, set the file appender before creating the SDK engine. Setting it later still affects subsequent log messages.

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