Class LogControl
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. Note, this class will load native libraries of the HERE SDK, therefore generally it should be used just before HERE SDK initialization, otherwise, it might have an unexpected performance impact if called not at the right time.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classInvalid file path exception. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidDisables HERE SDK logging messages to console.static voidenableLoggingToConsole(LogLevel level) Enables HERE SDK logging messages to console that can be viewed using logcat tool.static voidRemoves previously added custom log appender.static voidsetAppender(LogLevel level, LogAppender appender) Sets a custom log appender to receive log messages from the HERE SDK.static voidsetAppender(LogLevel level, String path) Sets a custom log appender that will write HERE SDK log messages to a file.
-
Method Details
-
enableLoggingToConsole
Enables HERE SDK logging messages to console that can be viewed using logcat tool. Enabled by default with
LogLevel.LOG_LEVEL_INFO.Setting a
LogLeveldefines the minimal level of messages which will be reported, based on the following hierarchy:LOG_LEVEL_INFOLOG_LEVEL_WARNINGLOG_LEVEL_ERRORLOG_LEVEL_FATAL
For example, when setting
LOG_LEVEL_ERROR, thenLOG_LEVEL_INFOandLOG_LEVEL_WARNINGwill 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.- Parameters:
level-Log level.
-
disableLoggingToConsole
public static void disableLoggingToConsole()Disables HERE SDK logging messages to console. Enabled by default with
LogLevel.LOG_LEVEL_INFO. -
setAppender
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
disableLoggingToConsole()API.- Parameters:
level-Log level.
appender-New log appender.
-
setAppender
public static void setAppender(@NonNull LogLevel level, @NonNull String path) throws LogControl.InvalidPathException 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
disableLoggingToConsole()API.- Parameters:
level-Log level.
path-Absolute path to a file that the application has read/write permissions.
- Throws:
LogControl.InvalidPathException-LogControl.InvalidPathExceptionIndicates that the file path is invalid or not writeable.
-
removeAppender
public static void removeAppender()Removes previously added custom log appender.
-