mirror of https://github.com/ThmmyNoLife/mTHMMY
Ezerous
8 years ago
31 changed files with 176 additions and 411 deletions
@ -1,81 +0,0 @@ |
|||
package mthmmy.utils; |
|||
|
|||
import android.util.Log; |
|||
|
|||
public class Report |
|||
{ |
|||
|
|||
public static void v (String TAG, String message) |
|||
{ |
|||
Log.v(TAG,message); |
|||
} |
|||
|
|||
public static void v (String TAG, String message, Throwable tr) |
|||
{ |
|||
Log.v(TAG,message + ": " + tr.getMessage(),tr); |
|||
} |
|||
|
|||
public static void d (String TAG, String message) |
|||
{ |
|||
Log.d(TAG,message); |
|||
} |
|||
|
|||
public static void d (String TAG, String message, Throwable tr) |
|||
{ |
|||
Log.d(TAG,message + ": " + tr.getMessage(),tr); |
|||
} |
|||
|
|||
public static void i (String TAG, String message) |
|||
{ |
|||
Log.i(TAG,message); |
|||
} |
|||
|
|||
public static void i (String TAG, String message, Throwable tr) |
|||
{ |
|||
Log.i(TAG,message + ": " + tr.getMessage(),tr); |
|||
} |
|||
|
|||
public static void w (String TAG, String message) |
|||
{ |
|||
Log.w(TAG,message); |
|||
} |
|||
|
|||
public static void w (String TAG, String message, Throwable tr) |
|||
{ |
|||
Log.w(TAG,message + ": " + tr.getMessage(),tr); |
|||
} |
|||
|
|||
public static void e (String TAG, String message) |
|||
{ |
|||
Log.e(TAG,message); |
|||
} |
|||
|
|||
public static void e (String TAG, String message, Throwable tr) |
|||
{ |
|||
Log.e(TAG,message + ": " + tr.getMessage(),tr); |
|||
} |
|||
|
|||
public static void wtf (String TAG, String message) |
|||
{ |
|||
Log.wtf(TAG,message); |
|||
} |
|||
|
|||
public static void wtf (String TAG, String message, Throwable tr) |
|||
{ |
|||
Log.wtf(TAG,message + ": " + tr.getMessage(),tr); |
|||
} |
|||
|
|||
/** |
|||
* Prints long messages in logcat (debug level). |
|||
*/ |
|||
public static void longMessage(String TAG, String message) |
|||
{ |
|||
int maxLogSize = 1000; |
|||
for(int i = 0; i <= message.length() / maxLogSize; i++) { |
|||
int start = i * maxLogSize; |
|||
int end = (i+1) * maxLogSize; |
|||
end = end > message.length() ? message.length() : end; |
|||
Report.d(TAG, message.substring(start, end)); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,34 @@ |
|||
package gr.thmmy.mthmmy.utils; |
|||
|
|||
import android.util.Log; |
|||
|
|||
import com.google.firebase.crash.FirebaseCrash; |
|||
|
|||
import gr.thmmy.mthmmy.utils.exceptions.UnknownException; |
|||
import timber.log.Timber; |
|||
|
|||
public class CrashReportingTree extends Timber.Tree { |
|||
@Override |
|||
protected void log(int priority, String tag, String message, Throwable t) { |
|||
if (priority == Log.VERBOSE || priority == Log.DEBUG) { |
|||
return; |
|||
} |
|||
|
|||
String level="A"; |
|||
|
|||
if (priority == Log.INFO) |
|||
level = "I"; |
|||
else if (priority == Log.WARN) |
|||
level = "W"; |
|||
else if(priority == Log.ERROR) |
|||
level = "E"; |
|||
|
|||
FirebaseCrash.log(level + "/" + tag + ": " + message); |
|||
|
|||
if(t==null) |
|||
t = new UnknownException("UnknownException"); |
|||
|
|||
if ((priority == Log.ERROR)) |
|||
FirebaseCrash.report(t); |
|||
} |
|||
} |
@ -1,96 +0,0 @@ |
|||
package mthmmy.utils; |
|||
|
|||
import com.google.firebase.crash.FirebaseCrash; |
|||
|
|||
import gr.thmmy.mthmmy.utils.exceptions.UnknownException; |
|||
|
|||
public class Report |
|||
{ |
|||
|
|||
public static void v (String TAG, String message) |
|||
{ |
|||
log("V", TAG, message); |
|||
} |
|||
|
|||
public static void v (String TAG, String message, Throwable tr) |
|||
{ |
|||
exception("V", TAG, message, tr); |
|||
} |
|||
|
|||
public static void d (String TAG, String message) |
|||
{ |
|||
log("D", TAG, message); |
|||
} |
|||
|
|||
public static void d (String TAG, String message, Throwable tr) |
|||
{ |
|||
exception("D", TAG, message, tr); |
|||
} |
|||
|
|||
public static void i (String TAG, String message) |
|||
{ |
|||
log("I", TAG, message); |
|||
} |
|||
|
|||
public static void i (String TAG, String message, Throwable tr) |
|||
{ |
|||
exception("I", TAG, message, tr); |
|||
} |
|||
|
|||
public static void w (String TAG, String message) |
|||
{ |
|||
log("W", TAG, message); |
|||
} |
|||
|
|||
public static void w (String TAG, String message, Throwable tr) |
|||
{ |
|||
exception("W", TAG, message, tr); |
|||
} |
|||
|
|||
public static void e (String TAG, String message) |
|||
{ |
|||
log("E", TAG, message); |
|||
} |
|||
|
|||
public static void e (String TAG, String message, Throwable tr) |
|||
{ |
|||
exception("E", TAG, message, tr); |
|||
} |
|||
|
|||
public static void wtf (String TAG, String message) |
|||
{ |
|||
log("WTF", TAG, message); |
|||
} |
|||
|
|||
public static void wtf (String TAG, String message, Throwable tr) |
|||
{ |
|||
exception("WTF", TAG, message, tr); |
|||
} |
|||
|
|||
private static void log(String level, String TAG, String message) |
|||
{ |
|||
if(!level.equals("V")&&!level.equals("D")) //don't log V and D levels
|
|||
{ |
|||
FirebaseCrash.log(level + "/" + TAG + ": " + message); |
|||
if(level.equals("E")||level.equals("WTF")) //report only serious exceptions
|
|||
FirebaseCrash.report(new UnknownException("UnknownException")); |
|||
} |
|||
} |
|||
|
|||
private static void exception(String level, String TAG, String message, Throwable tr) |
|||
{ |
|||
if(!level.equals("V")&&!level.equals("D")) //don't log V and D levels
|
|||
{ |
|||
FirebaseCrash.log(level + "/" + TAG + ": " + message + ": " + tr.getMessage()); |
|||
if(level.equals("E")||level.equals("WTF")) //report only serious exceptions
|
|||
FirebaseCrash.report(tr); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Does nothing in release. |
|||
*/ |
|||
public static void longMessage(String TAG, String level, String message) {return;} |
|||
|
|||
|
|||
} |
@ -1,6 +1,6 @@ |
|||
#Mon Dec 28 10:00:20 PST 2015 |
|||
#Wed Mar 08 11:25:21 EET 2017 |
|||
distributionBase=GRADLE_USER_HOME |
|||
distributionPath=wrapper/dists |
|||
zipStoreBase=GRADLE_USER_HOME |
|||
zipStorePath=wrapper/dists |
|||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip |
|||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip |
|||
|
Loading…
Reference in new issue