logs are printed twice
Hi, after upgrading KMM project to Kotlin 2.0.21 we are experiencing a strange problem: logs are written twice. Basically fun performLog get called twice (i have extended base AntiLog for better control over flow). Did you have experienced same problem or did you have any idea on how to deal with this?
Thx
ps: i have tested just ios
Make sure your Napier was not call initialized twice...
The same I see in Android, with Kotlin 2.0 on Multiplatform. All log messages are duplicated.
So you can't call Napier.base() more than once? I want to change the logging implementation on the fly. Something like this:
override fun attachBaseContext(base: Context?) {
// I need logging as soon as possible to catch loggin during initialization (e.g., before hilt runs dependency injection)
Napier.base(DebugAntiLog())
Timber.plant(NapierTree())
super.attachBaseContext(base)
}
override fun onCreate() {
super.onCreate()
// we need initialization to be complete to set up the crashlytics logging.
Napier.base(CrashlyticsAntiLog())
}
@mandrachek The quickest solution is to use a proxy in DebugAntiLog. After CrashlyticsAntiLog has been initialized, you can set the proxy to CrashlyticsAntiLog.