package net.fredericosilva.andlog;

import android.util.Log;

/**
 * Created by frederico <fredericojssilva@gmail.com>
 * on 29/10/2015 .
 */
public class AndLog {
    public static boolean LOG_DEBUG_MESSAGES = true;

    /*
    DEBUG
     */
    public static void d(String message) {
        d(getTag(), message);
    }

    public static void d(String tag, String message) {
        if (LOG_DEBUG_MESSAGES) {
            Log.d(tag, message);
        }
    }

    /*
      INFO
    */
    public static void i(String message) {
        i(getTag(), message);
    }

    public static void i(String tag, String message) {
        if (LOG_DEBUG_MESSAGES) {
            Log.i(tag, message);
        }
    }

    /*
    VERBOSE
    */
    public static void v(String message) {
        v(getTag(), message);
    }

    public static void v(String tag, String message) {
        if (LOG_DEBUG_MESSAGES) {
            Log.v(tag, message);
        }
    }

    /*
    WTF
    */
    public static void wtf(String message) {
        wtf(getTag(), message);
    }

    public static void wtf(String tag, String message) {
        if (LOG_DEBUG_MESSAGES) {
            Log.wtf(tag, message);
        }
    }

    /*
    WARN
    */
    public static void w(String message) {
        w(getTag(), message);
    }

    public static void w(String tag, String message) {
        if (LOG_DEBUG_MESSAGES) {
            Log.w(tag, message);
        }
    }

    /*
    ERROR
    */
    public static void e(String message) {
        e(getTag(), message);
    }

    public static void e(String tag, String message) {
        if (LOG_DEBUG_MESSAGES) {
            Log.e(tag, message);
        }
    }

    public static void hereIam() {
        if (LOG_DEBUG_MESSAGES) {
            Log.d(getTag(), getCallerMethod() + " called");
        }
    }

    private static String getTag() {
        return new Exception().getStackTrace()[2].getClass().getSimpleName();
    }

    private static String getCallerMethod() {
        return new Exception().getStackTrace()[2].getMethodName();
    }

}
@@ -211,16 +211,111 @@
  true;%0A%0A
+    public static void setDebugMode(boolean debug)%7B%0A        LOG_DEBUG_MESSAGES = debug;%0A    %7D%0A%0A
     /*%0A 
@@ -1956,39 +1956,49 @@
 Tag() %7B%0A        
-return 
+String className=
 new Exception().
@@ -2028,25 +2028,82 @@
 lass
-().getSimpleName(
+Name();%0A%0A        return className.substring(className.lastIndexOf('.') + 1
 );%0A 

fix classSimpleName & add setDebugMode