Kermit icon indicating copy to clipboard operation
Kermit copied to clipboard

Kermit default Logger crashes in Android Unit Test

Open LandryNorris opened this issue 2 years ago • 2 comments

By default, the LogcatWriter is used on Android. This will crash on Android unit tests, since the android.util.Log class is not mocked. The workaround is to setup the CommonLogger in every test, which is easy to forget about.

LandryNorris avatar Feb 13 '23 20:02 LandryNorris

It would be nice to separately have an AndroidWriter that will check if running in unit tests, and delegate to LogcatWriter if running in the app, and CommonWriter if running in test. This would prevent adding complexity to existing LogcatWriter, while avoiding pushing extra responsibility to users.

LandryNorris avatar Feb 13 '23 20:02 LandryNorris

Related with: https://github.com/touchlab/Kermit/issues/184

mustafaozhan avatar Feb 22 '23 10:02 mustafaozhan