The Kermit web page says "Disable local logging fo...
# touchlab-tools
m
The Kermit web page says "Disable local logging for production, or even strip log statements altogether with a compiler plugin" but I can't find any reference to these in the documents. Where should I look?
k
We should remove that part of the docs. In an earlier version we had a compiler plugin that could simply remove all logging calls from the compiled code. However, it was experimental, and we were asking for feedback. We wound up never using it, and I'd never heard from anybody who'd used it. The new version of Kermit (not new now, but new at some point) changed the API fairly significantly so we dropped the compiler plugin. It is something we've considered re-adding if there was enough interest.
m
Thanks for that @kpgalligan. So what happens, or can happen, with logger calls in a release version? It's ugly having commented out logging calls throughout the code. What are the options for leaving them in place and neutralising them, eg for live versions?
k
Ah! I saw the stripping and focused on that. For release builds, you need to configure different
LogWriter
instances. For example, in dev you'd probably just want the default ones, which are designed for development. In release, you'd explicitly set the
LogWriter
instances which might be something like Crashlytics, or zero
LogWriter
instances, which would prevent all logging. You can also specify a global minimum logging severity, so maybe you only log errors. In summary, though, you config logging at startup. You globally set what loggers you want, based on whether you're in release or not. Determining if you're in release mode is a different topic, with multiple approaches, but that's not specifically a "Kermit" thing. Usually I have the host app pass in a boolean for that, and the check for release is platform-specific.
m
Ok, thanks. I can (at least start to) sort that out.