mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user