mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 15:29:15 +01:00
logging: add file-based logging and a Send logs option
Capture logs to rotating app-private files with Subsonic credential and URL basic-auth redaction, mirror to Logcat, and capture uncaught crashes. Log slow SQL (>100ms), SQL errors, migrations and DB lifecycle via a decorating SQLiteDriver. Add a Send logs row in Settings that zips the logs and opens the share sheet through a FileProvider.
This commit is contained in:
+17
-1
@@ -158,10 +158,12 @@ val integrationTestClasses =
|
||||
|
||||
val demoScreenshotClass = "com.subtracks.ui.DemoScreenshotTest"
|
||||
|
||||
val queryTimingClass = "com.subtracks.data.db.QueryTimingMeasurementTest"
|
||||
|
||||
tasks.withType<Test>().configureEach {
|
||||
if (name.endsWith("UnitTest")) {
|
||||
filter {
|
||||
(integrationTestClasses + demoScreenshotClass).forEach { excludeTestsMatching(it) }
|
||||
(integrationTestClasses + demoScreenshotClass + queryTimingClass).forEach { excludeTestsMatching(it) }
|
||||
}
|
||||
}
|
||||
testLogging {
|
||||
@@ -197,6 +199,20 @@ tasks.register<Test>("demoScreenshots") {
|
||||
outputs.upToDateWhen { false }
|
||||
}
|
||||
|
||||
tasks.register<Test>("queryTiming") {
|
||||
description = "Measures SQL query timings for the logging threshold (not a CI gate)"
|
||||
group = "verification"
|
||||
val unitTest = tasks.named<Test>("testDebugUnitTest")
|
||||
dependsOn("compileDebugUnitTestKotlin")
|
||||
testClassesDirs = files(provider { unitTest.get().testClassesDirs })
|
||||
classpath = files(provider { unitTest.get().classpath })
|
||||
filter {
|
||||
includeTestsMatching(queryTimingClass)
|
||||
}
|
||||
providers.gradleProperty("measureSongs").orNull?.let { systemProperty("measure.songs", it) }
|
||||
outputs.upToDateWhen { false }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform(libs.androidx.compose.bom))
|
||||
implementation(libs.androidx.core.ktx)
|
||||
|
||||
Reference in New Issue
Block a user