-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logging and log views on MainScreen.
- Loading branch information
1 parent
e24c52a
commit f3ebc01
Showing
9 changed files
with
68 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
cipackageinstaller/src/main/java/dev/atsushieno/cipackageinstaller/Logging.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package dev.atsushieno.cipackageinstaller | ||
|
||
import android.util.Log | ||
import androidx.compose.runtime.mutableStateListOf | ||
|
||
// Collects log entries that should be shown to the user | ||
class Logger { | ||
class LogEntry(val text: String, val artifact: ApplicationArtifact? = null) | ||
|
||
val logs = mutableStateListOf<LogEntry>() | ||
|
||
fun logError(message: String, ex: Exception? = null, artifact: ApplicationArtifact? = null) { | ||
logs.add(LogEntry(message, artifact)) | ||
Log.e(AppModel.LOG_TAG, message) | ||
if (ex != null) | ||
Log.e(AppModel.LOG_TAG, ex.toString()) | ||
} | ||
|
||
fun logInfo(message: String, artifact: ApplicationArtifact? = null) { | ||
logs.add(LogEntry(message, artifact)) | ||
Log.i(AppModel.LOG_TAG, message) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters