Kermit icon indicating copy to clipboard operation
Kermit copied to clipboard

Kermit 2.0.0-RC4 Gradle Plugin for Log Stripping Example

Open codesplode opened this issue 1 year ago • 6 comments

Description

I can't seem to find an example or means of getting the kermit log stripping plugin to function when upgrading to 2.0.0-RC4.

The feature is mentioned on the Kermit website but not mentioned at all in documentation or samples.

id("co.touchlab.kermit") version "2.0.0-RC4" yields an "UnknownPluginException" from Gradle, but the same works with version 1.2.2

I'm happy to help with documentation for this once I learn how to get it working again myself.

Thanks

Thank you for another great utility library.

codesplode avatar Apr 14 '23 17:04 codesplode

I think the plugin wasn't published for 2.0.0 because we weren't sure it was useful or if people were using it. Were you depending on it in 1.x?

russhwolf avatar Apr 19 '23 21:04 russhwolf

Apologies for the late response. Yes, we were using it to strip logs from ios builds, but can remove it if you don't think it has value or is too much to maintain. We like the idea, but understand if it distracts from the primary features. Also happy to help and learn if there is something we can do to help keep it around.

codesplode avatar Apr 26 '23 19:04 codesplode

Stripping log calls would be nice for low level libraries that want all possible optimizations. Example: I'm building a TCP/UDP multiplatform library and while logs are ok during development, I don't want the overhead in production.

lppedd avatar Oct 05 '23 11:10 lppedd

I'm also interested in this.

I did a quick attempt on using proguard to remove the log calls, but unfortunatelly it didn't work. Probably some small mistake on my side. I'll debug later.

Here are my proguard rules, on top of the optimized defaults:

# Remove all logging calls from the co.touchlab.kermit package.
-assumenosideeffects class co.touchlab.kermit.Logger {
    public final void v(...);
    public final void d(...);
    public final void i(...);
    public final void w(...);
    public final void e(...);
    public final void a(...);
}
-assumenosideeffects class co.touchlab.kermit.Logger$Companion {
    public final void v(...);
    public final void d(...);
    public final void i(...);
    public final void w(...);
    public final void e(...);
    public final void a(...);
}

nicolasf avatar Apr 08 '24 17:04 nicolasf

Hey, did you get it working?

kasem-sm avatar May 11 '24 04:05 kasem-sm

@kasem-sm unfortunatelly not. I didn't have time to test this further. I'll probably look into it in a couple of months, but as far as I know this should bo doable with proguard.

nicolasf avatar May 11 '24 15:05 nicolasf