Created
March 23, 2019 18:38
-
-
Save dev-ritik/6adb26c89dfc8f90f804262784f5b2f5 to your computer and use it in GitHub Desktop.
My usual Android Timber plant message string format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void setupTimber() { | |
Timber.plant(new Timber.DebugTree() { | |
@Override | |
protected String createStackElementTag(StackTraceElement element) { | |
return "timber " + super.createStackElementTag(element) + " : "+ element.getMethodName()+" : " + element.getLineNumber(); | |
} | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun setupTimber() { | |
if (BuildConfig.DEBUG) { | |
Timber.plant(object : Timber.DebugTree() { | |
override fun createStackElementTag(element: StackTraceElement): String? { | |
return "timber " + element.lineNumber+" : "+super.createStackElementTag(element) + " : " + element.methodName | |
} | |
}) | |
} else { | |
Timber.plant(CrashlyticsTree()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment