diff --git a/app/src/main/java/eu/darken/capod/common/debug/recording/core/Recorder.kt b/app/src/main/java/eu/darken/capod/common/debug/recording/core/Recorder.kt index f61be52e..56337470 100644 --- a/app/src/main/java/eu/darken/capod/common/debug/recording/core/Recorder.kt +++ b/app/src/main/java/eu/darken/capod/common/debug/recording/core/Recorder.kt @@ -1,6 +1,7 @@ package eu.darken.capod.common.debug.recording.core import eu.darken.capod.common.TimeSource +import eu.darken.capod.common.debug.Bugs import eu.darken.capod.common.debug.logging.FileLogger import eu.darken.capod.common.debug.logging.Logging import eu.darken.capod.common.debug.logging.Logging.Priority.INFO @@ -33,6 +34,10 @@ class Recorder @Inject constructor( it.start() Logging.install(it) log(TAG, INFO) { "Now logging to file!" } + // Flipped here rather than only from the committed module state: that publishes after + // the recording header has been read, and everything written in that window would miss + // the debug-only diagnostics that key off this flag. + Bugs.isDebug.value = true } } @@ -52,6 +57,7 @@ class Recorder @Inject constructor( } finally { fileLogger = null this@Recorder.path = null + Bugs.isDebug.value = false } } } diff --git a/app/src/test/java/testhelpers/BaseTest.kt b/app/src/test/java/testhelpers/BaseTest.kt index d19e1710..ce7ae1b3 100644 --- a/app/src/test/java/testhelpers/BaseTest.kt +++ b/app/src/test/java/testhelpers/BaseTest.kt @@ -1,5 +1,6 @@ package testhelpers +import eu.darken.capod.common.debug.Bugs import eu.darken.capod.common.debug.logging.Logging import eu.darken.capod.common.debug.logging.Logging.Priority.VERBOSE import eu.darken.capod.common.debug.logging.log @@ -12,6 +13,10 @@ open class BaseTest { init { Logging.clearAll() Logging.install(JUnitLogger()) + // JVM-global and written by anything that starts a debug recording. Reset per test instance + // and not in a companion teardown: the JUnit 5 @AfterAll below never fires under the JUnit 4 + // Robolectric runner that the recorder tests use. + Bugs.isDebug.value = false testClassName = this.javaClass.simpleName }