Last active
August 29, 2015 14:24
-
-
Save ParkSangGwon/5c05687215320d776dc6 to your computer and use it in GitHub Desktop.
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
public class Dlog { | |
static final String TAG = "TedPark"; | |
/** Log Level Error **/ | |
public static final void e(String message) { | |
if (BaseApplication.DEBUG)Log.e(TAG, buildLogMsg(message)); | |
} | |
/** Log Level Warning **/ | |
public static final void w(String message) { | |
if (BaseApplication.DEBUG)Log.w(TAG, buildLogMsg(message)); | |
} | |
/** Log Level Information **/ | |
public static final void i(String message) { | |
if (BaseApplication.DEBUG)Log.i(TAG, buildLogMsg(message)); | |
} | |
/** Log Level Debug **/ | |
public static final void d(String message) { | |
if (BaseApplication.DEBUG)Log.d(TAG, buildLogMsg(message)); | |
} | |
/** Log Level Verbose **/ | |
public static final void v(String message) { | |
if (BaseApplication.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(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment