<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>logcat Archives - Creatronix</title>
	<atom:link href="https://creatronix.de/tag/logcat/feed/" rel="self" type="application/rss+xml" />
	<link>https://creatronix.de/tag/logcat/</link>
	<description>My adventures in code &#38; business</description>
	<lastBuildDate>Thu, 10 Feb 2022 21:29:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Logging in Android with Timber</title>
		<link>https://creatronix.de/logging-in-android-with-timber/</link>
		
		<dc:creator><![CDATA[Jörn]]></dc:creator>
		<pubDate>Mon, 25 Oct 2021 09:13:03 +0000</pubDate>
				<category><![CDATA[Android & iOS development]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[logcat]]></category>
		<category><![CDATA[loggin]]></category>
		<category><![CDATA[timber]]></category>
		<guid isPermaLink="false">https://creatronix.de/?p=3866</guid>

					<description><![CDATA[<p>In this article I show you how to use timber for logging in your Android App. Timber is built upon Android&#8217;s Log class. If you are not yet familiar with logging in Android have a look at Logging in Android Dependency Timber has just on dependency. Nice! dependencies { implementation 'com.jakewharton.timber:timber:5.0.1' } Initialization in Application&#8230;</p>
<p>The post <a href="https://creatronix.de/logging-in-android-with-timber/">Logging in Android with Timber</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In this article I show you how to use timber for logging in your Android App.</p>
<p>Timber is built upon Android&#8217;s Log class. If you are not yet familiar with logging in Android have a look at <a href="https://creatronix.de/logging-in-android/">Logging in Android</a><span id="more-3866"></span></p>
<h2>Dependency</h2>
<p>Timber has just on dependency. Nice!</p>
<pre>dependencies {
  implementation <span class="pl-s"><span class="pl-pds">'</span>com.jakewharton.timber:timber:5.0.1<span class="pl-pds">'</span></span>
}</pre>
<h2>Initialization in Application</h2>
<p>To use Timber in your app you need an application class where you call the static method Timber.plant</p>
<pre>import android.app.Application
import timber.log.Timber

class LevelUpApplication : Application()  {
    override fun onCreate() {
        super.onCreate()
<span id="13d3" class="bx ma kb fp ls b bu mb mc s md" data-selectable-paragraph=""><strong class="ls jz">        if </strong>(BuildConfig.<em class="jc">DEBUG</em>) {
            Timber.plant(DebugTree())
        }
</span>    } 
}</pre>
<p>Make sure that your custom application class is referenced in your manifest:</p>
<pre>&lt;application
    android:name=".LevelUpApplication"
    ...
&gt;</pre>
<h2>Import &amp; Logging</h2>
<p>After you have added Timber Android Studio highlights the old log statements:</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-3901" src="https://creatronix.de/wp-content/uploads/2021/10/timber.png" alt="" width="785" height="198" srcset="https://creatronix.de/wp-content/uploads/2021/10/timber.png 785w, https://creatronix.de/wp-content/uploads/2021/10/timber-300x76.png 300w, https://creatronix.de/wp-content/uploads/2021/10/timber-768x194.png 768w" sizes="(max-width: 785px) 100vw, 785px" /></p>
<p>Timber is imported via</p>
<pre>import timber.log.Timber</pre>
<p>And the new log statement looks like this:</p>
<pre>Timber.d("onCreate")</pre>
<p>The new log statement has no TAG element so you can remove the companion object from your class.</p>
<p><a href="https://github.com/JakeWharton/timber">Timber on github</a></p>
<p>The post <a href="https://creatronix.de/logging-in-android-with-timber/">Logging in Android with Timber</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
