<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alexey Korolev on Medium]]></title>
        <description><![CDATA[Stories by Alexey Korolev on Medium]]></description>
        <link>https://medium.com/@alexeykorolev?source=rss-9bc88062c12a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*VpvrYbl-tSo5O7pu.jpg</url>
            <title>Stories by Alexey Korolev on Medium</title>
            <link>https://medium.com/@alexeykorolev?source=rss-9bc88062c12a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 10:35:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alexeykorolev/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Thank you for the article.]]></title>
            <link>https://medium.com/@alexeykorolev/thank-you-for-the-article-90e1d0a7cf29?source=rss-9bc88062c12a------2</link>
            <guid isPermaLink="false">https://medium.com/p/90e1d0a7cf29</guid>
            <dc:creator><![CDATA[Alexey Korolev]]></dc:creator>
            <pubDate>Wed, 08 Feb 2023 10:03:29 GMT</pubDate>
            <atom:updated>2023-02-08T10:04:10.013Z</atom:updated>
            <content:encoded><![CDATA[<p>Thank you for the article. Just wanted to share the setupBuilder helper function modification I&#39;ve finally used. The only change is: not using &#39;any&#39; as a type.</p><p>export const setupBuilder =</p><p>&lt;T,&gt;(Comp: React.FC&lt;any&gt;, mockProps: T) =&gt;</p><p>(overrides = {}): RenderAPI &amp; T =&gt; {</p><p>const props: T = { ...mockProps, ...overrides };</p><p>const utils = render(&lt;Comp {...props} /&gt;);</p><p>return { ...utils, ...props };</p><p>};</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90e1d0a7cf29" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Logger Library — The Kotlin way]]></title>
            <link>https://medium.com/att-israel/logger-library-the-kotlin-way-248f99d3c042?source=rss-9bc88062c12a------2</link>
            <guid isPermaLink="false">https://medium.com/p/248f99d3c042</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[logcat]]></category>
            <category><![CDATA[logger]]></category>
            <category><![CDATA[debugging]]></category>
            <dc:creator><![CDATA[Alexey Korolev]]></dc:creator>
            <pubDate>Wed, 24 Jun 2020 10:15:28 GMT</pubDate>
            <atom:updated>2020-06-24T10:15:28.865Z</atom:updated>
            <content:encoded><![CDATA[<h3>Become a master of logging in Android</h3><h4>Tiny Kotlin logging library with tips and tricks — log as a pro.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vIs3CFBuu5APa6U9" /><figcaption>Photo by <a href="https://unsplash.com/@zanilic?utm_source=medium&amp;utm_medium=referral">Zan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The default logging solution is minimal, and I believe that most of you have already written a wrapper class and copied it from project to project. Or maybe you have created a library as I did.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*CxHHExnV37jLJPtaL7XejA.png" /><figcaption>This is how your logs would look if you follow this guide.</figcaption></figure><p>First, I created the Logging library for a Java project, but recently I’ve converted this library to Kotlin, and now I want to share it with you.</p><p>In this article, we will cover the following subjects:</p><ul><li>Android Studio Logcat customizations</li><li>MyLog library integration and configuration with usage examples</li><li>Personal logs style customization by using a local.properties file</li><li>Proguard rules for excluding our logs from production code</li></ul><h3>Android Studio Logcat customizations:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XS8jFEG6DqUhji1Y" /><figcaption>Photo by <a href="https://unsplash.com/@stri_khedonia?utm_source=medium&amp;utm_medium=referral">Alice Pasqual</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Logcat header customization</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*qnzh_5g0M-r1UISg2WFoKw.png" /><figcaption>What our logs usually look like</figcaption></figure><p>At first, we will hide the Logcat header. Please follow the instructions below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*myx0XITGuSRrWowniGtyLA.png" /><figcaption>Open settings by clicking on the gears icon.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*JuEbsQhBMOe83KZtVpsTHA.png" /><figcaption>Uncheck all the options.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/254/1*2zA_EBagkAVkNnqs3aHexw.png" /><figcaption>Now the logs should look like this:</figcaption></figure><h4>Customize Logcat color scheme</h4><p>File -&gt; Settings -&gt; Editor -&gt; Color Scheme-&gt; Android Logcat</p><p>Here you can customize the style for each logging level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*OS5PO2c3dn9Xa-CnJF9oPw.png" /></figure><p>The colors that I prefer to use are:</p><ul><li>Verbose: #BBBBBB</li><li>Debug: #0BB100</li><li>Info: #BBA500</li><li>Warning: #D08400</li><li>Error: #FF6B68</li><li>Assert: #FF6B68 (bold)</li></ul><h3>MyLogKt library integration and configuration with usage examples</h3><p>BTW, if it is an issue for you to add a third-party library, you can always simply copy <a href="https://github.com/Pulimet/MyLogLibrary/blob/master/mylogkt/src/main/java/net/alexandroid/utils/mylogkt/MyLogKt.kt">this file</a> to your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pnrQMRd3Yc-sxx2q" /><figcaption>Photo by <a href="https://unsplash.com/@setbydaniel?utm_source=medium&amp;utm_medium=referral">Danny</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Installation</h4><p>Just add a dependency at your build.gradle file:</p><pre>implementation &#39;net.alexandroid.utils:mylogkt:1.12&#39;</pre><h4>Simple usage example</h4><pre>private fun justPrintLogs() {<br>    <em>logD</em>()<br>    <em>logD</em>(&quot;Empty 1&quot;)<br>    <em>logI</em>(&quot;Empty 2&quot;)<br>    <em>logW</em>(&quot;Empty 3&quot;)<br>    <em>logE</em>(&quot;Empty 4&quot;)<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*GPBMhgAy7LrJe5sLphuUHQ.png" /><figcaption>Default logs style</figcaption></figure><h4>Enabling/disabling logs</h4><p>We can enable/disable the logs by changing the <strong>isLogsShown</strong> flag. If your logs should be visible only in debug, set the flag to “BuildConfig.<em>DEBUG”.</em></p><pre>MyLogKt.isLogsShown = false / true / BuildConfig.<em>DEBUG</em></pre><h4>Change default tag</h4><p>The default library tag is “<em>MyLog”</em>. To change it, modify the <strong>tag </strong>string.</p><pre>private fun changeTag() {<br>    <em>logD</em>(&quot;Log with default tag&quot;)<br>    MyLogKt.tag = &quot;CustomDefaultTag&quot;<br>    <em>logD</em>(&quot;Changed default tag&quot;)<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*BspC-G1y34w064CCTcnvOQ.png" /></figure><h4>Default tag postfix</h4><p>Custom tag by default is undefined.</p><pre>private fun customTag() {<br>    <em>logD</em>(&quot;Without custom tag&quot;)<br>    <em>logD</em>(&quot;Custom tag example 1&quot;, &quot;CustomTag1&quot;)<br>    <em>logD</em>(&quot;Custom tag example 2&quot;, &quot;CustomTag2&quot;)<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*bA46NV4MgTP4rhcjQ3ZBTA.png" /></figure><h4>Add an exception to the log</h4><pre>private fun printExceptionLog() {<br>    <em>logE</em>(&quot;Show Exception&quot;, t = NullPointerException())<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*QWPQLdE6BDQm1ZpmRjOpXA.png" /></figure><h4>Show a package name before the class name</h4><p>By default package name isn’t shown.</p><pre>private fun showPackageName() {<br>    <em>logW</em>(&quot;Show package disabled&quot;)<br>    MyLogKt.packageName = <em>packageName<br>    </em>MyLogKt.isPackageNameVisible = true<br>    <em>logW</em>(&quot;Show package enabled&quot;)<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*B7qynf2reGITkXhGXjPkEg.png" /></figure><h4>Time format or time visibility</h4><pre>private fun hideTime() {<br>    <em>logD</em>(&quot;Default time format&quot;)<br>    MyLogKt.timeFormat = &quot;HH:mm&quot;<br>    <em>logD</em>(&quot;Time format changed&quot;)<br>    MyLogKt.isTimeVisible = false<br>    <em>logW</em>(&quot;Show time disabled&quot;)<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*KhwC0wEnb0s6LV_KE-cBvw.png" /></figure><h4>Show the thread name</h4><pre>private fun showThreadId() {<br>    <em>logW</em>(&quot;Show thread name disabled&quot;)<br>    MyLogKt.isThreadNameVisible = true<br>    <em>logW</em>(&quot;Show thread name enabled&quot;)<br>    <em>thread </em><strong>{ </strong><em>logD</em>(&quot;Other thread&quot;) }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*Nxtxi2bjBx4h9tzf-y1jMg.png" /></figure><h4>Long naming wrapping</h4><p>*Also, you can set <strong>classNameLength </strong>and <strong>methodNameLength</strong></p><pre>private fun aFunctionWithVeryLongName() {<br>    <em>logD</em>(&quot;Wrapping enabled by default&quot;)<br>    MyLogKt.isLengthShouldWrap = false<br>    <em>logD</em>(&quot;Wrapping disabled&quot;)<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*vAPtG-9YXuk81MvIzpAy_A.png" /></figure><h4>Disable spacing</h4><pre>private fun space() {<br>    <em>logD</em>(&quot;Spacing enabled&quot;)<br>    MyLogKt.isSpacingEnabled = false<br>    <em>logD</em>(&quot;Spacing disabled&quot;)<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*fWJEPUYUhz_k1oikZGAjqg.png" /></figure><h3>Personal log style customization by using a local.properties file</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NAFNRO0gnjy0XRZE" /><figcaption>Photo by <a href="https://unsplash.com/@kellysikkema?utm_source=medium&amp;utm_medium=referral">Kelly Sikkema</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Recently when I suggested adding this library to my current project, each developer told me how they want the logs to be formatted. And this brings us to the solution described below.</p><h4>Let’s start by editing the local.properties file</h4><p>As you know, this file, by default ignored, and this allows us to set custom configurations without sharing them with others.</p><pre>logger.isThreadNameVisible = false<br>logger.isTimeVisible = true<br>logger.isPackageNameVisible = false<br>logger.isClassNameVisible = true<br>logger.isMethodNameVisible = true<br>logger.isSpacingEnabled = true<br>logger.isLengthShouldWrap = true<br>logger.classNameLength = 20<br>logger.methodNameLength = 25</pre><h4>In your module create the logger.gradle file</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4791856b035f26781fba0cceb93bedb/href">https://medium.com/media/c4791856b035f26781fba0cceb93bedb/href</a></iframe><h4>In your module build.gradle add “apply from”</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/89a542d9fb8704dd96eedb937a07ac1d/href">https://medium.com/media/89a542d9fb8704dd96eedb937a07ac1d/href</a></iframe><h4>And the last step is to set library values.</h4><p>Somewhere add and invoke the function below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f37472e4c0bc37473d7711f6d45fe862/href">https://medium.com/media/f37472e4c0bc37473d7711f6d45fe862/href</a></iframe><p>That’s it. Now each developer on your team can customize the logs to look as they wish.</p><h3>Proguard rules for excluding our logs from production code</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a8i6SM95q22kvUn1" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When we add logs to our projects, we do not always think about the possible overhead that could be added.</p><p>Let’s assume that you are adding a log that prints a huge JSON, and in debugging, it’s OK, but in production, on some devices, this can add performance overhead. Or maybe you want to log the result of a function used only in debug, and in production, it crashes your app on some specific devices.</p><p>To prevent the issues described above, we can use proguard rules that will remove the log&#39;s functions from the production code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/be0bd33252b5981b0aeae880991e0fe2/href">https://medium.com/media/be0bd33252b5981b0aeae880991e0fe2/href</a></iframe><p>Thanks for your time:)</p><h3>Resources</h3><p><a href="https://github.com/Pulimet/MyLogLibrary">Pulimet/MyLogLibrary</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=248f99d3c042" width="1" height="1" alt=""><hr><p><a href="https://medium.com/att-israel/logger-library-the-kotlin-way-248f99d3c042">Logger Library — The Kotlin way</a> was originally published in <a href="https://medium.com/att-israel">AT&amp;T Israel Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>