@@ -0,0 +1,2160 @@
+/***%0AThis is free and unencumbered software released into the public domain.%0A%0AAnyone is free to copy, modify, publish, use, compile, sell, or%0Adistribute this software, either in source code form or as a compiled%0Abinary, for any purpose, commercial or non-commercial, and by any%0Ameans.%0A%0AFor more information, please refer to %3Chttp://unlicense.org/%3E%0A*/%0A%0Apackage com.mustafaferhan.debuglog;%0A%0Aimport android.util.Log;%0A%0A%0A/**%0A * @date 21.06.2012%0A * @author Mustafa Ferhan Akman%0A * %0A * Create a simple and more understandable Android logs. %0A * */%0A%0Apublic class DebugLog%7B%0A%0A%09static String className;%0A%09static String methodName;%0A%09%0A%0A%09public static boolean isDebuggable() %7B%0A%09%09return BuildConfig.DEBUG;%0A%09%7D%0A%0A%09private static String createLog( String log ) %7B%0A%0A%09%09StringBuffer buffer = new StringBuffer();%0A%09%09buffer.append(%22%5B%22);%0A%09%09buffer.append(methodName);%0A%09%09buffer.append(%22%5D%22);%0A%09%09buffer.append(log);%0A%0A%09%09return buffer.toString();%0A%09%7D%0A%09%0A%09private static void getMethodNames(StackTraceElement%5B%5D sElements)%7B%0A%09%09className = sElements%5B1%5D.getFileName();%0A%09%09methodName = sElements%5B1%5D.getMethodName();%0A%09%7D%0A%0A%09public static void e(String message)%7B%0A%09%09if (!isDebuggable())%0A%09%09%09return;%0A%0A%09%09// Throwable instance must be created before any methods  %0A%09%09getMethodNames(new Throwable().getStackTrace());%0A%09%09Log.e(className, createLog(message));%0A%09%7D%0A%0A%09public static void i(String message)%7B%0A%09%09if (!isDebuggable())%0A%09%09%09return;%0A%0A%09%09getMethodNames(new Throwable().getStackTrace());%0A%09%09Log.i(className, createLog(message));%0A%09%7D%0A%09%0A%09public static void d(String message)%7B%0A%09%09if (!isDebuggable())%0A%09%09%09return;%0A%0A%09%09getMethodNames(new Throwable().getStackTrace());%0A%09%09Log.d(className, createLog(message));%0A%09%7D%0A%09%0A%09public static void v(String message)%7B%0A%09%09if (!isDebuggable())%0A%09%09%09return;%0A%0A%09%09getMethodNames(new Throwable().getStackTrace());%0A%09%09Log.v(className, createLog(message));%0A%09%7D%0A%09%0A%09public static void w(String message)%7B%0A%09%09if (!isDebuggable())%0A%09%09%09return;%0A%0A%09%09getMethodNames(new Throwable().getStackTrace());%0A%09%09Log.w(className, createLog(message));%0A%09%7D%0A%09%0A%09public static void wtf(String message)%7B%0A%09%09if (!isDebuggable())%0A%09%09%09return;%0A%0A%09%09getMethodNames(new Throwable().getStackTrace());%0A%09%09Log.wtf(className, createLog(message));%0A%09%7D%0A%0A%7D%0A

add debug log class to library project