JakeWharton / JakeWharton/timber

Expensive to filter on package name and priority

Open
#217 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
10.8k
Forks
994
Avg merge
17h 16m
Merged PRs (30d)
17

Description

**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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading Tree.getTag(), DebugTree.createStackElementTag(), and isLoggable() to trace how caller package names and priorities are handled. Confirm the proposed priority-aware API preserves the existing getTag() behavior, then verify that package and priority filtering can be decided without extracting the caller name twice.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.