AsapLoggerExtensionProxy
AsapLoggerExtensionProxy defines a log-loading interface, which enables custom loading of logs by implementing and registering the interface.
Interface signature
copy
interface AsapLoggerExtensionProxy : AsapExtensionProxy {
fun d(tag: String, msg: String)
fun i(tag: String, msg: String)
fun v(tag: String, msg: String)
fun w(tag: String, msg: String, throwable: Throwable?=null)
fun e(tag: String, msg: String, throwable: Throwable?=null)
}
Method
Method name | Description |
d | Send a DEBUG log message. |
i | Send an INFO log message. |
v | Send a VERBOSE log message. |
w | Send a WARN log message and log the exception. |
e | Send an ERROR log message and log the exception. |
Parameters
Field | Data type | Description |
tag | String | The tag used to identify the source of a log message. |
msg | String | The message you want to log. |
throwable | Throwable? | An exception to log. |
Samples
copy
@AsapExtension(AsapLoggerExtensionProxy::class)
class Logger : AsapLoggerExtensionProxy {
private val loggerTag="DEMO"
override fun d(tag: String, msg: String) {
Log.d(loggerTag,"$tag======$msg")
}
override fun i(tag: String, msg: String) {
Log.i(loggerTag,"$tag======$msg")
}
override fun v(tag: String, msg: String) {
Log.v(loggerTag,"$tag======$msg")
}
override fun w(tag: String, msg: String, throwable: Throwable?) {
Log.w(loggerTag,"$tag======$msg",throwable)
}
override fun e(tag: String, msg: String, throwable: Throwable?) {
Log.e(loggerTag,"$tag======$msg",throwable)
}
}