package ru.tulupov.nsuconnect.util;


import android.content.Context;

import com.bugsense.trace.BugSenseHandler;
import com.google.analytics.tracking.android.EasyTracker;
import com.google.analytics.tracking.android.MapBuilder;

public class Log {
    private static Context CONTEXT;

    public static void init(Context context) {
        CONTEXT = context.getApplicationContext();
    }


    public static void e(String tag, String msg) {
        android.util.Log.e(tag, msg);

        EasyTracker.getInstance(CONTEXT).send(MapBuilder.createException(String.format("%s: %s", tag, msg), false).build());
        BugSenseHandler.addCrashExtraData(tag, msg);
    }

    public static void e(String tag, String msg, Exception tr) {
        android.util.Log.e(tag, msg, tr);

        EasyTracker.getInstance(CONTEXT).send(MapBuilder.createException(String.format("%s: %s: %s",
                tag,
                msg,
                android.util.Log.getStackTraceString(tr)),
                false).build());


        BugSenseHandler.sendExceptionMessage(tag, msg, tr);
    }

    public static void v(String tag, String msg) {
        android.util.Log.v(tag, msg);
    }

    public static void d(String tag, String msg) {
        android.util.Log.d(tag, msg);
    }
}

@@ -471,24 +471,42 @@
 tag, msg);%0A%0A
+        try %7B%0A    
         Easy
@@ -618,16 +618,77 @@
 ild());%0A
+        %7D catch (Throwable e) %7B%0A%0A        %7D%0A        try %7B%0A    
         
@@ -724,32 +724,75 @@
 Data(tag, msg);%0A
+        %7D catch (Throwable e) %7B%0A%0A        %7D%0A
     %7D%0A%0A    publi
@@ -889,17 +889,34 @@
 g, tr);%0A
-%0A
+        try %7B%0A    
         
@@ -1024,16 +1024,20 @@
         
+    
 tag,%0A   
@@ -1053,13 +1053,21 @@
     
+  
+  
 msg,%0A
+    
     
@@ -1137,16 +1137,20 @@
         
+    
 false).b
@@ -1158,18 +1158,77 @@
 ild());%0A
-%0A%0A
+        %7D catch (Throwable e) %7B%0A%0A        %7D%0A        try %7B%0A    
         
@@ -1275,24 +1275,67 @@
 , msg, tr);%0A
+        %7D catch (Throwable e) %7B%0A%0A        %7D%0A
     %7D%0A%0A    p

Fix logs