Is there any way to set custom Logger for koin before startKoin in android App?
Or maybe set Logger as a parameter for startKoin.
Main issue with current AndroidLogger() is that it's set in Application.startKoin() and make visible all KOIN logs to everyone in release builds.
Hello,
Koin logging is set by default with startKoin. I will add the ability to set the needed logger.
Stay in touch.
Thanks
Agreed, it should never log anything by default.
My solution to this issue was to manually remove the Android logger.
You can use it meanwhile...
//startKoin here
Koin.logger = if (isDebugMode())
org.koin.android.logger.AndroidLogger() else
org.koin.log.EmptyLogger()
Passing an extra param to enable logs is the best solution.
I was thinking about putting Koin.logger as nullable and check in startKoin if it's not already set, to put the default value. It would allow to write Koin.logger = EmptyLogger() before startKoin, if we are in release.
I'll prefer an optional parameter Logger for Application.startKoin()
Ok to make it as an optional param.
Available in 0.9.0-alpha-5. startKoin has now an optional parameter for Koin logger logger.
Most helpful comment
Available in
0.9.0-alpha-5.startKoinhas now an optional parameter for Koin loggerlogger.