Goal: allow a Tree subclass that can filter by package name at different priority levels for each.
Today, a Tree subclass can return null based on the fully qualified name of the calling class, and then isLoggable can be overridden to return false if the tag is null.
But then if you also want to filter based on priority on a per-package basis, it's too late. By the time isLoggable() is called, you've already calculated and trimmed down the tag, losing the package name. So you would have to extract the caller's full class name a second time.
Could Tree.getTag() (and correspondingly DebugTree.createStackElementTag) receive the priority as a parameter, so the filtering decision could be made in a single place?
By default, Tree.getTag(int priority) would fall back to Tree.getTag() for a fully backwards-compatible solution.
If this is acceptable I can generate a pull request.
Goal: allow a Tree subclass that can filter by package name at different priority levels for each.
Today, a Tree subclass can return
null
based on the fully qualified name of the calling class, and thenisLoggable
can be overridden to returnfalse
if the tag isnull
.But then if you also want to filter based on priority on a per-package basis, it's too late. By the time
isLoggable()
is called, you've already calculated and trimmed down the tag, losing the package name. So you would have to extract the caller's full class name a second time.Could
Tree.getTag()
(and correspondinglyDebugTree.createStackElementTag
) receive the priority as a parameter, so the filtering decision could be made in a single place?By default,
Tree.getTag(int priority)
would fall back toTree.getTag()
for a fully backwards-compatible solution.If this is acceptable I can generate a pull request.