-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add BuildConfig.DEBUG option
- Loading branch information
Showing
2 changed files
with
52 additions
and
43 deletions.
There are no files selected for viewing
86 changes: 45 additions & 41 deletions
86
tedpermission/src/main/java/com/gun0912/tedpermission/util/Dlog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,53 @@ | ||
package com.gun0912.tedpermission.util; | ||
|
||
import android.util.Log; | ||
|
||
import com.gun0912.tedpermission.BuildConfig; | ||
|
||
public class Dlog { | ||
|
||
static final String TAG = "tedpark"; | ||
|
||
|
||
/** Log Level Error **/ | ||
public static void e(String message) { | ||
Log.e(TAG, buildLogMsg(message)); | ||
} | ||
/** Log Level Warning **/ | ||
public static void w(String message) { | ||
Log.w(TAG, buildLogMsg(message)); | ||
} | ||
/** Log Level Information **/ | ||
public static void i(String message) { | ||
Log.i(TAG, buildLogMsg(message)); | ||
} | ||
/** Log Level Debug **/ | ||
public static void d(String message) { | ||
Log.d(TAG, buildLogMsg(message)); | ||
} | ||
/** Log Level Verbose **/ | ||
public static void v(String message){Log.v(TAG, buildLogMsg(message)); | ||
} | ||
|
||
|
||
public static String buildLogMsg(String message) { | ||
|
||
StackTraceElement ste = Thread.currentThread().getStackTrace()[4]; | ||
|
||
StringBuilder sb = new StringBuilder(); | ||
|
||
sb.append("["); | ||
sb.append(ste.getFileName().replace(".java", "")); | ||
sb.append("::"); | ||
sb.append(ste.getMethodName()); | ||
sb.append("]"); | ||
sb.append(message); | ||
|
||
return sb.toString(); | ||
|
||
} | ||
static final String TAG = "tedpark"; | ||
|
||
/** Log Level Error **/ | ||
public static void e(String message) { | ||
|
||
if (BuildConfig.DEBUG) Log.e(TAG, buildLogMsg(message)); | ||
} | ||
|
||
/** Log Level Warning **/ | ||
public static void w(String message) { | ||
if (BuildConfig.DEBUG) Log.w(TAG, buildLogMsg(message)); | ||
} | ||
|
||
/** Log Level Information **/ | ||
public static void i(String message) { | ||
|
||
if (BuildConfig.DEBUG) Log.i(TAG, buildLogMsg(message)); | ||
} | ||
|
||
/** Log Level Debug **/ | ||
public static void d(String message) { | ||
|
||
if (BuildConfig.DEBUG) Log.d(TAG, buildLogMsg(message)); | ||
} | ||
|
||
/** Log Level Verbose **/ | ||
public static void v(String message) { | ||
if (BuildConfig.DEBUG) Log.v(TAG, buildLogMsg(message)); | ||
} | ||
|
||
public static String buildLogMsg(String message) { | ||
|
||
StackTraceElement ste = Thread.currentThread().getStackTrace()[4]; | ||
|
||
StringBuilder sb = new StringBuilder(); | ||
|
||
sb.append("["); | ||
sb.append(ste.getFileName().replace(".java", "")); | ||
sb.append("::"); | ||
sb.append(ste.getMethodName()); | ||
sb.append("]"); | ||
sb.append(message); | ||
|
||
return sb.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters