package com.onebit.logger;

import android.os.Build;
import android.util.Log;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by scijoker on 08.10.15.
 */
public class Logger {

    public static void d(String tag, String arg) {
        Log.d(tag, arg);
    }

    public static void dd(String tag, Object source) {
        if (isJSONValid(source)) {
            try {
                format(tag, new JSONObject(source.toString()).toString(2));
            } catch (JSONException e) {
                e.printStackTrace();
            }
        } else {
            format(tag, source);
        }
    }

    private static void format(String tag, Object source) {
        tag = " " + tag + " ";
        d(" ", " ");
        d(" ", getSplitter(50) + tag + getSplitter(50));
        d(" ", "" + source);
        d(" ", getSplitter(100 + tag.length()));
        d(" ", " ");
    }

    private static String getSplitter(int length) {
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < length; i++) {
            builder.append("-");
        }
        return builder.toString();
    }

    private static boolean isJSONValid(Object test) {
        try {
            new JSONObject(test.toString());
        } catch (JSONException ex) {
            try {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                    new JSONArray(test);
                }
            } catch (JSONException ex1) {
                return false;
            }
        }
        return true;
    }
}

@@ -305,24 +305,149 @@
 rg);%0A    %7D%0A%0A
+    public static void d(String logMsg) %7B%0A        d(getCurrentClassName(), getCurrentMethodName() + %22(): %22 + logMsg);%0A    %7D%0A%0A
     public s
@@ -501,27 +501,31 @@
     if (
-isJSONValid
+containsJsonStr
 (source)
@@ -772,32 +772,265 @@
        %7D%0A    %7D%0A%0A
+    private static String getSplitter(int length) %7B%0A        StringBuilder builder = new StringBuilder();%0A        for (int i = 0; i %3C length; i++) %7B%0A            builder.append(%22-%22);%0A        %7D%0A        return builder.toString();%0A    %7D%0A%0A
     private stat
@@ -1321,156 +1321,293 @@
  get
-Splitter(int length) %7B%0A        StringBuilder builder = new StringBuilder();%0A        for (int i = 0; i %3C length; i++) %7B%0A            builder.append(%22-
+CurrentMethodName() %7B%0A        return Thread.currentThread().getStackTrace()%5B4%5D.getMethodName();%0A    %7D%0A%0A    private static String getCurrentClassName() %7B%0A        String className = Thread.currentThread().getStackTrace()%5B4%5D.getClassName();%0A%0A        String%5B%5D temp = className.split(%22%5B%5C%5C.%5D
 %22);%0A
@@ -1617,44 +1617,68 @@
     
+ 
- %7D%0A        return builder.toString()
+className = temp%5Btemp.length - 1%5D;%0A        return className
 ;%0A  
@@ -1713,19 +1713,23 @@
 ean 
-isJSONValid
+containsJsonStr
 (Obj

Update Logger.java