is there a way in Timber to show parent method name in the logs android

183 views Asked by At

I know that I can show the method names in Timber and even the line number using something like that

  class MyDebugTree : DebugTree() {

        override fun createStackElementTag(element: StackTraceElement): String? {
            return String.format(
                " [M:%s] [C:%s]",
                element.methodName,
                super.createStackElementTag(element)
            )
        }
    }

but what I want to do is not only to show the method name containing the Timber statement but also the parent method.
Example: I want to show the name of method a

 fun a(){
   b()
}
fun b(){
 Timber.d("statement")
}
0

There are 0 answers