fix(logging): Install logger before Hilt injection

super.onCreate() triggers Hilt's singleton construction, so any log emitted
during that graph build was discarded before the logger existed.

Fixes review finding F2
This commit is contained in:
darken
2026-07-28 19:07:54 +02:00
committed by Matthias Urhahn
parent c9a5db1ac8
commit 82cc9764e5
+4 -1
View File
@@ -44,8 +44,11 @@ open class App : Application() {
@Inject @AppScope lateinit var appScope: CoroutineScope
override fun onCreate() {
super.onCreate()
// Must stay ABOVE super.onCreate(): that call performs the Hilt injection which constructs
// our singletons. Anything they log while being created is dropped if no logger is installed
// yet. Do not "tidy" this line back below super.onCreate().
if (BuildConfig.DEBUG) Logging.install(LogCatLogger())
super.onCreate()
val oldHandler = Thread.getDefaultUncaughtExceptionHandler()
Thread.setDefaultUncaughtExceptionHandler(