To make it work you can add a new module to your project and copy content of this library or add this repository as a child repo. The application stores logs and sessions in a local db data.
Initialization is required to initialize the local library and data sources.
AppLogLibrary.init(this)
It's required to create a session instance, so all logs will be linked to a specific session.
SessionDataSource.createNewSession()
There are a few types of logs that you can track:
INFO - used to track general information WARNING - used to track developer warning ERROR - used to track error cases IN_MESSAGE - used for messages received on Mobile phone OUT_MESSAGE - used for messages sent from Mobile phone
LogsDataSource - is a main class to collect and add logs. It has several method calls to add logs into the system.
You can also add optional class name and method name for additional debug purposes.
suspend fun w(className: String, methodName: String, message: String) suspend fun w(message: String)
You can also add optional class name and method name for additional debug purposes.
suspend fun i(className: String, methodName: String, message: String) suspend fun i(message: String)
You can also add optional class name and method name for additional debug purposes.
suspend fun w(className: String, methodName: String, message: String) suspend fun w(message: String)
You can also add optional class name and method name for additional debug purposes.
suspend fun e(className: String, methodName: String, message: String) suspend fun e(message: String)
You can also add optional class name and method name for additional debug purposes.
suspend fun inMessage(className: String, methodName: String, message: String) suspend fun inMessage(message: String)
You can also add optional class name and method name for additional debug purposes.
suspend fun outMessage(className: String, methodName: String, message: String) suspend fun outMessage(message: String)
The library includes LogsActivity that can display collected messages for the active session, a list of previous sessions, and session details. The app can open it by executing the next command.
startActivity(Intent(this, LogsActivity::class.java))
The library also includes LogDialogFragment. It's a dialog fragment that can display current session logs.
LogDialogFragment().show(
supportFragmentManager, LogDialogFragment.TAG)
The library can be used to collect logs, help to understand issues on the user side, and provide access for the end user to view and share logs.