Beagle’s log system allows you to investigate errors during the development and problems that may happen with the application’s production.
The log messages given by Android Beagle can be accessed in the:
The log system is divided in 3 categories:
interface BeagleLogger {
fun warning(message: String)
fun error(message: String)
fun error(message: String, throwable: Throwable)
fun info(message: String)
}
parse
, http
and other exceptions.It is possible to disable triggered log messages. Beagle will not call the Log’s API, even if it is default or customized. You will need to change the attribute isLoggingEnabled
ofAppBeagleConfig
tofalse:
@BeagleComponent
class AppBeagleConfig : BeagleConfig {
override val isLoggingEnabled: Boolean = false
}
You will create a class that implements BeagleLogger
interface. This protocol must be defined to ease the error management generated in the server-driven context of your application. You can implement the methods the best way for your application.
In order to let Beagle’s environment open to modifications, the default API logs can be replaced by any other.
The customization is configured with the creation of an annotation class with @BeagleComponent
that implements the BeagleLogger
Interface.
This interface needs logs method implementation, you can check how it works on the example below:
import android.util.Log
import br.com.zup.beagle.android.annotation.BeagleComponent
import br.com.zup.beagle.android.logger.BeagleLogger
private const val BEAGLE_TAG = "BeagleSDK"
@BeagleComponent
class BeagleLoggerDefault : BeagleLogger {
override fun warning(message: String) {
Log.w(BEAGLE_TAG, message)
}
override fun error(message: String) {
Log.e(BEAGLE_TAG, message)
}
override fun error(message: String, throwable: Throwable) {
Log.e(BEAGLE_TAG, message, throwable)
}
override fun info(message: String) {
Log.i(BEAGLE_TAG, message)
}
}
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.