Skip to content

Commit

Permalink
Add log API for non release builds. (#2108)
Browse files Browse the repository at this point in the history
Make v(),d(),i() logs not print for release builds.

These logs still prints for fishfood and dogfood builds.

b/315852240

Co-authored-by: Colin Liang <[email protected]>
  • Loading branch information
zhongqiliang and Colin Liang committed Dec 16, 2023
1 parent db48e3c commit cec32f1
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions starboard/android/apk/app/src/main/java/dev/cobalt/util/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,24 @@ private static int logWithMethod(
}

public static int v(String tag, String messageTemplate, Object... args) {
return logWithMethod(logV, tag, messageTemplate, args);
if (android.util.Log.isLoggable(TAG, android.util.Log.VERBOSE)) {
return logWithMethod(logV, tag, messageTemplate, args);
}
return 0;
}

public static int d(String tag, String messageTemplate, Object... args) {
return logWithMethod(logD, tag, messageTemplate, args);
if (android.util.Log.isLoggable(TAG, android.util.Log.DEBUG)) {
return logWithMethod(logD, tag, messageTemplate, args);
}
return 0;
}

public static int i(String tag, String messageTemplate, Object... args) {
return logWithMethod(logI, tag, messageTemplate, args);
if (android.util.Log.isLoggable(TAG, android.util.Log.INFO)) {
return logWithMethod(logI, tag, messageTemplate, args);
}
return 0;
}

public static int w(String tag, String messageTemplate, Object... args) {
Expand Down

0 comments on commit cec32f1

Please sign in to comment.