Skip to content

Commit

Permalink
Fixed #387 proguard issue with "SourceCode" and line numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
davideas committed Jun 16, 2017
1 parent d754fb9 commit 61abe09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ protected void onCreate(Bundle savedInstanceState) {
}

setContentView(R.layout.activity_main);
FlexibleAdapter.enableLogs(Level.DEBUG);
if (BuildConfig.DEBUG) {
FlexibleAdapter.enableLogs(Level.DEBUG);
} else {
FlexibleAdapter.enableLogs(Level.SUPPRESS);
}
Log.v("onCreate");

// Initialize Toolbar, Drawer & FAB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
*/
public class Log {

private static int LEVEL;
private static final String SOURCE_FILE = "SourceFile";
private static int LEVEL = SUPPRESS;
private static boolean withMethodName;
private static boolean withLineNumber;

Expand Down Expand Up @@ -241,7 +242,9 @@ public static void wtf(Throwable t, String msg, Object... args) {

private static String getTag() {
StackTraceElement traceElement = new Throwable().getStackTrace()[2];
return traceElement.getFileName().split("[.]")[0];
String fileName = traceElement.getFileName();
if (fileName == null) return SOURCE_FILE;
return fileName.split("[.]")[0];
}

private static String formatMessage(String msg, Object... args) {
Expand Down

0 comments on commit 61abe09

Please sign in to comment.