8
8
public class IterableLogger {
9
9
10
10
public static void d (String tag , String msg ) {
11
- if (isLoggable (Log .DEBUG )) {
11
+ if (isLoggableLevel (Log .DEBUG )) {
12
12
Log .d (tag , " 💚 " + msg );
13
13
}
14
14
}
15
15
16
16
public static void d (String tag , String msg , Throwable tr ) {
17
- if (isLoggable (Log .DEBUG )) {
17
+ if (isLoggableLevel (Log .DEBUG )) {
18
18
Log .d (tag , " 💚 " + msg , tr );
19
19
}
20
20
}
21
21
22
22
public static void v (String tag , String msg ) {
23
- if (isLoggable (Log .VERBOSE )) {
23
+ if (isLoggableLevel (Log .VERBOSE )) {
24
24
Log .v (tag , msg );
25
25
}
26
26
}
27
27
28
28
public static void w (String tag , String msg ) {
29
- if (isLoggable (Log .WARN )) {
29
+ if (isLoggableLevel (Log .WARN )) {
30
30
Log .w (tag , " 🧡️ " + msg );
31
31
}
32
32
}
33
33
34
34
public static void w (String tag , String msg , Throwable tr ) {
35
- if (isLoggable (Log .WARN )) {
35
+ if (isLoggableLevel (Log .WARN )) {
36
36
Log .w (tag , " 🧡 " + msg , tr );
37
37
}
38
38
}
39
39
40
40
public static void e (String tag , String msg ) {
41
- if (isLoggable (Log .ERROR )) {
41
+ if (isLoggableLevel (Log .ERROR )) {
42
42
Log .e (tag , " ❤️ " + msg );
43
43
}
44
44
}
45
45
46
46
public static void e (String tag , String msg , Throwable tr ) {
47
- if (isLoggable (Log .ERROR )) {
47
+ if (isLoggableLevel (Log .ERROR )) {
48
48
Log .e (tag , " ❤️ " + msg , tr );
49
49
}
50
50
}
@@ -57,15 +57,6 @@ public static void printInfo() {
57
57
}
58
58
}
59
59
60
- private static boolean isLoggable (int messageLevel ) {
61
- boolean isDebug = ((IterableApi .getInstance ().getMainActivityContext ().getApplicationInfo ().flags & IterableApi .getInstance ().getMainActivityContext ().getApplicationInfo ().FLAG_DEBUGGABLE ) != 0 );
62
- if (isDebug ) {
63
- return isLoggableLevel (messageLevel );
64
- }
65
- // Log level will be set to WARNING and above if in release mode.
66
- return messageLevel >= Log .WARN ;
67
- }
68
-
69
60
private static boolean isLoggableLevel (int messageLevel ) {
70
61
return messageLevel >= getLogLevel ();
71
62
}
0 commit comments