I want to create a new class in my android app to use crashlytics logging. That I want to do is create some methods that match the android.util.Log and I want to call the crashlytics method within ( Crashlytics.getInstance().core.log). But I don't have clear how can I do it... Someone can help me?
For example, I can do something like this?
Copy all Log.class in a new class and do
private Log() {
Crashlytics.getInstance().core.log
}
public static int v(String tag, String msg) {
return println_native(LOG_ID_MAIN, VERBOSE, tag, msg);
}
. . .
And in another class.
Log.v(tag, message);
This could work?
答案 0 :(得分:2)
您可以执行以下操作:
private CrashlyticsCore getCrashlytics() {
return Crashlytics.getInstance().core;
}
public void logDebug(String tag, String message) {
getCrashlytics().log(Log.DEBUG, tag, message);
}
然后在应用程序的另一部分中调用
logDebug(TAG, "This is a log message");