Skip to content

Commit ab0750b

Browse files
committed
[MOB - 3703] - Sensitive log information
1. Additional check to see if the App is debuggable. If so, only then -> consider config.logLevel or else, stick with default -> or anything above Warning level
1 parent 12f2908 commit ab0750b

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

iterableapi/src/main/java/com/iterable/iterableapi/IterableLogger.java

+15-6
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,37 @@ public static void d(String tag, String msg) {
1414
}
1515

1616
public static void d(String tag, String msg, Throwable tr) {
17-
if (isLoggableLevel(Log.DEBUG)) {
17+
if (isLoggable(Log.DEBUG)) {
1818
Log.d(tag, " 💚 " + msg, tr);
1919
}
2020
}
2121

2222
public static void v(String tag, String msg) {
23-
if (isLoggableLevel(Log.VERBOSE)) {
23+
if (isLoggable(Log.VERBOSE)) {
2424
Log.v(tag, msg);
2525
}
2626
}
2727

2828
public static void w(String tag, String msg) {
29-
if (isLoggableLevel(Log.WARN)) {
29+
if (isLoggable(Log.WARN)) {
3030
Log.w(tag, " 🧡️ " + msg);
3131
}
3232
}
3333

3434
public static void w(String tag, String msg, Throwable tr) {
35-
if (isLoggableLevel(Log.WARN)) {
35+
if (isLoggable(Log.WARN)) {
3636
Log.w(tag, " 🧡 " + msg, tr);
3737
}
3838
}
3939

4040
public static void e(String tag, String msg) {
41-
if (isLoggableLevel(Log.ERROR)) {
41+
if (isLoggable(Log.ERROR)) {
4242
Log.e(tag, " ❤️ " + msg);
4343
}
4444
}
4545

4646
public static void e(String tag, String msg, Throwable tr) {
47-
if (isLoggableLevel(Log.ERROR)) {
47+
if (isLoggable(Log.ERROR)) {
4848
Log.e(tag, " ❤️ " + msg, tr);
4949
}
5050
}
@@ -57,6 +57,15 @@ public static void printInfo() {
5757
}
5858
}
5959

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+
6069
private static boolean isLoggableLevel(int messageLevel) {
6170
return messageLevel >= getLogLevel();
6271
}

0 commit comments

Comments
 (0)