0

我正在尝试使用anko公共库在 logcat 上记录调试消息。我想在调试版本中显示日志消息,而不是在签名版本中。我知道我也可以删除登录签名版本Proguard

我想知道anko库本身是否仅在调试构建的情况下记录消息?或者它也在签名版本中?

这是库的Logger实用程序https://github.com/Kotlin/anko/blob/d5a526512b48c5cd2e3b8f6ff14b153c2337aa22/anko/library/static/commons/src/Logging.ktanko

/**
 * Send a log message with the [Log.DEBUG] severity.
 * Note that the log message will not be written if the current log level is above [Log.DEBUG].
 * The default log level is [Log.INFO].
 *
 * @param message the function that returns message text to log.
 *   `null` value will be represent as "null", for any other value the [Any.toString] will be invoked.
 *
 * @see [Log.d].
 */
inline fun AnkoLogger.debug(message: () -> Any?) {
    val tag = loggerTag
    if (Log.isLoggable(tag, Log.DEBUG)) {
        Log.d(tag, message()?.toString() ?: "null")
    }
}

我是否需要使用 proguard 删除日志记录?或使用一些BuildConfig.ktanko图书馆管理自己?

4

0 回答 0