File tree Expand file tree Collapse file tree 1 file changed +18
-11
lines changed
app/src/main/java/tech/httptoolkit/android Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -4,21 +4,28 @@ import android.os.Build
44
55fun formatTag (tag : String ): String {
66 return if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .N ) {
7- tag
7+ if (tag.startsWith(" tech.httptoolkit.android" )) {
8+ tag
9+ } else {
10+ // In some cases (e.g. coroutines) our code runs in the context of
11+ // other classes - make sure we prefix it for findability regardless.
12+ " tech.httptoolkit.android ($tag )"
13+ }
814 } else {
9- tag.substring(0 , 23 ) // Before API 24 there's a 23 char length limit
15+ // Before API 24 there's a 23 char length limit we need to stay under:
16+ (
17+ if (tag.startsWith(" tech.httptoolkit.android" )) {
18+ tag.replace(" tech.httptoolkit.android" , " tech.httptoolkit..." )
19+ } else {
20+ // In some cases (e.g. coroutines) our code runs in the context of
21+ // other classes - make sure we prefix it for findability regardless.
22+ " tech.httptoolkit... ($tag )"
23+ }
24+ ).substring(0 , 23 )
1025 }
1126}
1227
1328val Any .TAG : String
1429 get() {
15- val name = if (javaClass.name.startsWith(" tech.httptoolkit.android" )) {
16- javaClass.name
17- } else {
18- // In some cases (e.g. coroutines) our code runs in the context of
19- // other classes - make sure we prefix it for findability regardless.
20- " tech.httptoolkit.android ($javaClass .name)"
21- }
22-
23- return formatTag(name)
30+ return formatTag(javaClass.name)
2431 }
You can’t perform that action at this time.
0 commit comments