Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set custom logger before startKoin() in Android #50

Closed
dkrivoruchko opened this issue Feb 13, 2018 · 8 comments
Closed

Set custom logger before startKoin() in Android #50

dkrivoruchko opened this issue Feb 13, 2018 · 8 comments
Assignees
Milestone

Comments

@dkrivoruchko
Copy link

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.

@arnaudgiuliani arnaudgiuliani added this to the 0.9.0 milestone Feb 13, 2018
@arnaudgiuliani
Copy link
Member

Hello,

Koin logging is set by default with startKoin. I will add the ability to set the needed logger.

Stay in touch.

@dkrivoruchko
Copy link
Author

Thanks

@erickok
Copy link
Contributor

erickok commented Feb 13, 2018

Agreed, it should never log anything by default.

@fredy-mederos
Copy link
Contributor

fredy-mederos commented Feb 13, 2018

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.

@arnaudgiuliani
Copy link
Member

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.

@dkrivoruchko
Copy link
Author

I'll prefer an optional parameter Logger for Application.startKoin()

@arnaudgiuliani
Copy link
Member

Ok to make it as an optional param.

@arnaudgiuliani arnaudgiuliani self-assigned this Feb 13, 2018
@arnaudgiuliani
Copy link
Member

arnaudgiuliani commented Feb 15, 2018

Available in 0.9.0-alpha-5. startKoin has now an optional parameter for Koin logger logger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants