File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
transport/transport-runtime/src/main/java/com/google/android/datatransport/runtime/logging Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 14
14
15
15
package com .google .android .datatransport .runtime .logging ;
16
16
17
+ import android .os .Build ;
17
18
import android .util .Log ;
18
19
19
20
public final class Logging {
21
+ private static final String LOG_PREFIX = "TRuntime." ;
22
+ private static final int MAX_LOG_TAG_SIZE_IN_SDK_N = 23 ;
23
+
20
24
private Logging () {}
21
25
22
26
private static String getTag (String tag ) {
23
- return "TransportRuntime." + tag ;
27
+ if (android .os .Build .VERSION .SDK_INT < Build .VERSION_CODES .N ) return concatTag (LOG_PREFIX , tag );
28
+
29
+ return LOG_PREFIX + tag ;
30
+ }
31
+
32
+ private static String concatTag (String prefix , String tag ) {
33
+ String concatText = prefix + tag ;
34
+
35
+ if (concatText .length () > MAX_LOG_TAG_SIZE_IN_SDK_N )
36
+ concatText = concatText .substring (0 , MAX_LOG_TAG_SIZE_IN_SDK_N );
37
+
38
+ return concatText ;
24
39
}
25
40
26
41
public static void d (String tag , String message ) {
You can’t perform that action at this time.
0 commit comments