5
當DebugTree
記錄時,我看到類名稱,但是當我創建自定義樹時,標記爲null
。這裏就是我的自定義樹是這個樣子:使用木材時標記爲空
public class CrashlyticsTree extends Timber.Tree {
private static final String CRASHLYTICS_KEY_PRIORITY = "priority";
private static final String CRASHLYTICS_KEY_TAG = "tag";
private static final String CRASHLYTICS_KEY_MESSAGE = "message";
@Override
protected boolean isLoggable(int priority) {
if (priority == Log.VERBOSE || priority == Log.DEBUG || priority == Log.INFO) {
return false;
}
// only log WARN(Timber.w), ERROR(Timber.e), or WTF(Timber.wtf)
return true;
}
@Override
protected void log(int priority, @Nullable String tag, @Nullable String message, @Nullable Throwable t) {
if(User.CurrentUser.isLoggedIn()){
Crashlytics.setUserIdentifier(Long.toString(User.CurrentUser.getUserId()));
}
Crashlytics.setInt(CRASHLYTICS_KEY_PRIORITY, priority);
Crashlytics.setString(CRASHLYTICS_KEY_TAG, tag);
Crashlytics.setString(CRASHLYTICS_KEY_MESSAGE, message);
if (t == null) {
Crashlytics.logException(new Exception(message));
} else {
if(!TextUtils.isEmpty(message)){
Crashlytics.log(priority, tag, message);
}
Crashlytics.logException(t);
}
}
}
然而,即使從DebugTree,獲取生成的標籤是BaseActivity
,因爲它確實來自BaseActivity
但我不知道是否有一種方法可以讓我得到的名稱擴展BaseActivity