New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow override for tag depth #314
Conversation
Sort of addresses #180, but only on a per-tree basis rather than a per-log basis. |
* master: Fix ignored test by using INFO log instead of DEBUG log
Any interest in this? It goes a long way in allowing use of Timber with Java-only modules without requiring much change or maintenance from Timber IMO. |
This would be helpful for us. Currently resolved to calling Timber.tag(getTagFromStackTrace()) before logging calls. |
Is this going to be merged anytime soon? Would be very helpful when wrapping timber around your own logger, and be able still get the class name calling your custom wrapper. |
Do any of the debug tree's methods help in getting the tag from the stack trace or do we have to subclass DebugTree/get the stack trace ourselves without the api? |
@whoyawn This PR allows you to change that call stack index by overriding DebugTree, so you don't have to copy/paste. Though it really should take that index via constructor or setter, so you don't even have to override. I'll update it to do that if Jake shows any interest in merging this (which he probably won't because the master branch already has a completely different default tree for Timber 5). |
Closing this because it's very out of date (e.g. the main branch is now in Kotlin rather than Java). |
Any workaround here? I really need this feature |
You can create your own subclass of |
@drewhamilton But the problem is that tag is an internal field and so we can't override that. |
Ah you're right, I forgot about that. #362 is the Kotlin version of this PR; it's still open. |
Pull
DebugTree.CALL_STACK_INDEX
into a protectedgetLoggingDepth()
method. This is useful for apps that wrap Timber and don't want every tag to be "TimberWrapper" or whatever. Does not affect default behavior for users who don't want/need this.