touchlab / Kermit

Kermit by Touchlab is a Kotlin Multiplatform centralized logging utility.
https://kermit.touchlab.co
Apache License 2.0
699 stars 40 forks source link

Logs are not chunked on Android #394

Closed Nek-12 closed 3 months ago

Nek-12 commented 5 months ago

Kermit does not split long log statements into separate log invocations. As a result, any string longer than 4096 characters is cut off (not printed fully). This disallows using Kermit for e.g. http response logging. An example implementation of message splitting can be taken from Ktor or FlowMVI

samhill303 commented 4 months ago

We think the best way to accomplish this would be to implement a "ChunkedLogWriter" that can be used if desired as opposed to updating the default implementation. We a log writer that does that chunking could definitely be useful though. We'll add to our backlog, but welcome Pull Requests

Nek-12 commented 4 months ago

The default implementation should be to send logs as chunked. Most people wouldn't expect their logs to just suddenly be cut off.

samhill303 commented 4 months ago

Sorry if I misspoke by saying default implementation. What I meant is that the character limit is specific to logcat and wont necessarily be the same for other tools. For that reason it will be the responsibility of the LogWriter's to handle chunking correctly

Nek-12 commented 4 months ago

Yes, as far as I know, only android restricts log lines to 4096 symbols. Other platforms probably have 65536 char limit.

samhill303 commented 3 months ago

2.0.4 has been deployed with @psh 's ChunkedLogWriter. Thanks for the input and let us know if you have any issues