Logger

object Logger

Logging class for manage logcat in a debug/release mode. Under the hood we used Timber.

Example:

Logger.apply {
tag = "Tick"
isDebug = BuildConfig.DEBUG
onFilter { tag, message, throwable, level ->
if (level == LogLevel.ERROR) {
if (tag != null) {
YandexMetrica.reportError(tag, message, throwable)
} else {
YandexMetrica.reportError(message, throwable)
}
}
}
}
Logger.info(message = "Hello Affogato!")

Since

1.5.0

See also

Properties

Link copied to clipboard
@JvmField
var isDebug: Boolean

When is true printing logs, otherwise run onRelease block.

Link copied to clipboard
@JvmField
var tag: String

Logging tag help for better filter and search.

Functions

Link copied to clipboard
@JvmStatic
@JvmName(name = "wtf")
fun assert(tag: String?, message: String, throwable: Throwable?)

What a Terrible Failure: Report an exception that should never happen.

Link copied to clipboard
@JvmStatic
fun debug(tag: String?, message: String, throwable: Throwable?)

Send a DEBUG log message and log the exception.

Link copied to clipboard
@JvmStatic
fun error(tag: String?, message: String, throwable: Throwable?)

Send an ERROR log message and log the exception.

Link copied to clipboard
@JvmStatic
fun info(tag: String?, message: String, throwable: Throwable?)

Send an INFO log message and log the exception.

Link copied to clipboard
fun onFilter(block: (tag: String?, message: String, throwable: Throwable?, level: LogLevel) -> Unit)

With onRelease block, we define our api for logging in release mode like use crash service.

Link copied to clipboard
@JvmStatic
fun verbose(tag: String?, message: String, throwable: Throwable?)

Send a VERBOSE log message and log the exception.

Link copied to clipboard
@JvmStatic
fun warn(tag: String?, message: String, throwable: Throwable?)

Send a WARN log message and log the exception.