BleLogger

interface BleLogger

Logger interface for BLE-X library.

Implement this interface to provide custom logging behavior for the BLE-X library. This allows integration with various logging frameworks (Timber, SLF4J, etc.) or custom logging implementations.

Usage Example

Custom Logger Implementation

class TimberBleLogger : BleLogger {
override fun verbose(tag: String, message: String) {
Timber.tag(tag).v(message)
}
override fun debug(tag: String, message: String) {
Timber.tag(tag).d(message)
}
override fun info(tag: String, message: String) {
Timber.tag(tag).i(message)
}
override fun warn(tag: String, message: String) {
Timber.tag(tag).w(message)
}
override fun error(tag: String, message: String, throwable: Throwable?) {
if (throwable != null) {
Timber.tag(tag).e(throwable, message)
} else {
Timber.tag(tag).e(message)
}
}
}

// Set the custom logger
BleLog.logger = TimberBleLogger()

See also

Inheritors

Functions

Link copied to clipboard
abstract fun debug(tag: String, message: String)

Logs a debug message.

Link copied to clipboard
abstract fun error(tag: String, message: String, throwable: Throwable? = null)

Logs an error message with an optional throwable.

Link copied to clipboard
abstract fun info(tag: String, message: String)

Logs an informational message.

Link copied to clipboard
abstract fun verbose(tag: String, message: String)

Logs a verbose message.

Link copied to clipboard
abstract fun warn(tag: String, message: String)

Logs a warning message.