Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verbose Firebase logging #271

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=0.7.1-SNAPSHOT
VERSION_NAME=0.7.1-VLOGS-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Child Library
Expand Down
1 change: 1 addition & 0 deletions opensrp-child/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ allprojects {

dependencies {

implementation 'com.google.firebase:firebase-crashlytics:18.2.1'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.1'

api('org.smartregister:opensrp-client-core:4.3.18-SNAPSHOT@aar') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import id.zelory.compressor.Compressor;
import timber.log.Timber;
import com.google.firebase.crashlytics.FirebaseCrashlytics;

/**
* Created by ndegwamartin on 25/02/2019.
Expand Down Expand Up @@ -137,7 +138,7 @@ public AppProperties getProperties() {
public EventBus getEventBus() {

if (eventBus == null) {
Timber.e(" Event Bus instance does not exist!!! Pass the Implementing Application's Eventbus by invoking the " +
FirebaseCrashlytics.getInstance().recordException(new Exception("No Event Bus")); Timber.e(" Event Bus instance does not exist!!! Pass the Implementing Application's Eventbus by invoking the " +
ChildLibrary.class.getCanonicalName() + ".setEventBus method from the onCreate method of " + "your Application class ");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import java.util.Map;

import timber.log.Timber;
import com.google.firebase.crashlytics.FirebaseCrashlytics;

/**
* Base activity class for all other PATH activity classes. Implements: - A uniform navigation bar that is launched by
Expand Down Expand Up @@ -617,7 +618,7 @@ public void saveForm(String jsonString, UpdateRegisterParams updateRegisterParam
interactor.saveRegistration(childEventClientList, jsonString, updateRegisterParams, this);

} catch (Exception e) {
Timber.e(Log.getStackTraceString(e));
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(Log.getStackTraceString(e));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import androidx.viewpager.widget.ViewPager;

import com.google.android.material.tabs.TabLayout;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.vijay.jsonwizard.constants.JsonFormConstants;
import com.vijay.jsonwizard.domain.Form;

Expand Down Expand Up @@ -263,7 +264,7 @@ protected void onCreate(Bundle savedInstanceState) {
childUnderFiveFragment.setBoosterImmunizations(boosterImmunizations);
}
} catch (SQLiteException exception) {
Timber.e(exception);
FirebaseCrashlytics.getInstance().recordException(exception); Timber.e(exception);
}

childDetailsToolbar = findViewById(R.id.child_detail_toolbar);
Expand Down Expand Up @@ -427,7 +428,7 @@ private void dispatchTakePictureIntent() {
photoFile = createImageFile();
} catch (IOException ex) {
// Error occurred while creating the File
Timber.e(ex, "BaseChildDetailTabbedActivity --> dispatchTakePictureIntent");
FirebaseCrashlytics.getInstance().recordException(new Exception("BaseChildDetailTabbedActivity --> dispatchTakePictureIntent")); Timber.e(ex, "BaseChildDetailTabbedActivity --> dispatchTakePictureIntent");
}
// Continue only if the File was successfully created
if (photoFile != null) {
Expand Down Expand Up @@ -647,7 +648,7 @@ protected void launchDynamicVaccinesForm(String dynamicVaccinesForm, String mult
jsonObject.put(Constants.KEY.ENTITY_ID, childDetails.entityId());
startFormActivity(jsonObject.toString());
} catch (Exception e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}
}

Expand All @@ -656,7 +657,7 @@ protected void startJsonForm(String formName, String entityId) {
try {
startJsonForm(formName, entityId, locationId);
} catch (Exception e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}
}

Expand Down Expand Up @@ -692,7 +693,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
break;
}
} catch (Exception e) {
Timber.e(Log.getStackTraceString(e));
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(Log.getStackTraceString(e));
}

} else if (requestCode == REQUEST_TAKE_PHOTO && resultCode == RESULT_OK) {
Expand Down Expand Up @@ -892,7 +893,7 @@ public void updateClientAttribute(String attributeName, Object attributeValue) {
try {
ChildDbUtils.updateChildDetailsValue(attributeName, String.valueOf(attributeValue), childDetails.entityId());
} catch (Exception e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}
}

Expand Down Expand Up @@ -1144,7 +1145,7 @@ protected String getReportDeceasedMetadata() {
return form == null ? null : form.toString();

} catch (Exception e) {
Timber.e(Log.getStackTraceString(e));
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(Log.getStackTraceString(e));
}
return "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.Map;

import timber.log.Timber;
import com.google.firebase.crashlytics.FirebaseCrashlytics;

/**
* Created by ndegwamartin on 01/03/2019.
Expand All @@ -60,7 +61,7 @@ protected void onCreate(Bundle savedInstanceState) {
try {
form = new JSONObject(currentJsonState());
} catch (JSONException e) {
Timber.e(e.toString());
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e.toString());
}

enableOnCloseDialog = getIntent().getBooleanExtra(Constants.FormActivity.EnableOnCloseDialog, true);
Expand All @@ -82,7 +83,7 @@ protected void onResume() {


} catch (JSONException e) {
Timber.e(e.toString());
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e.toString());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
import timber.log.Timber;

import static org.smartregister.immunization.util.VaccinatorUtils.receivedVaccines;
import com.google.firebase.crashlytics.FirebaseCrashlytics;

/**
* Created by ndegwamartin on 06/03/2019.
Expand Down Expand Up @@ -587,7 +588,7 @@ private void updateServiceViews(Map<String, List<ServiceType>> serviceTypeMap, L
serviceGroup.setChildActive(isChildActive);
serviceGroup.updateChildsActiveStatus();
} catch (Exception e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}
}
}
Expand Down Expand Up @@ -801,7 +802,7 @@ private void updateVaccinationViews(List<Vaccine> vaccineList, List<Alert> alert
try {
addVaccineGroup(-1, vaccineGroup, vaccineList, alerts);
} catch (Exception e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}
}
} else {
Expand All @@ -810,7 +811,7 @@ private void updateVaccinationViews(List<Vaccine> vaccineList, List<Alert> alert
vaccineGroup.setChildActive(isChildActive);
vaccineGroup.updateChildsActiveStatus();
} catch (Exception e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}
}
}
Expand Down Expand Up @@ -1561,7 +1562,7 @@ private void addVaccineGroups(List<Vaccine> vaccineList, List<Alert> alerts, Has
vaccineGroups.remove(curGroup);
addVaccineGroup(Integer.parseInt((String) curGroup.getTag(R.id.vaccine_group_parent_id)), curGroup.getVaccineData(), vaccineList, alerts);
} catch (Exception e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}
}
}
Expand Down Expand Up @@ -2050,7 +2051,7 @@ public void processNextVaccineDate(String baseEntityId, List<Observation> observ
ChildJsonFormUtils.convertAndPersistEvent(nextVaccineDateEvent);

} catch (JSONException e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.Map;

import timber.log.Timber;
import com.google.firebase.crashlytics.FirebaseCrashlytics;

/**
* Created by ndegwamartin on 25/02/2019.
Expand Down Expand Up @@ -116,7 +117,7 @@ public void startFormActivity(String formName, String entityId, String metaData)
presenter().startForm(formName, entityId, metaData, locationId);
}
} catch (Exception e) {
Timber.e(Log.getStackTraceString(e));
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(Log.getStackTraceString(e));
displayToast(getString(R.string.error_unable_to_start_form));
}
}
Expand All @@ -129,7 +130,7 @@ public void startFormActivity(String formName, String entityId, Map<String, Stri
presenter().startForm(formName, entityId, metaData, locationId);
}
} catch (Exception e) {
Timber.e(Log.getStackTraceString(e));
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(Log.getStackTraceString(e));
displayToast(getString(R.string.error_unable_to_start_form));
}
}
Expand Down Expand Up @@ -193,7 +194,7 @@ protected void onActivityResultExtended(int requestCode, int resultCode, Intent

}
} catch (Exception e) {
Timber.e(Log.getStackTraceString(e));
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(Log.getStackTraceString(e));
}
}
}
Expand Down Expand Up @@ -272,7 +273,7 @@ public void startAdvancedSearch() {
// mPager.setCurrentItem(ADVANCED_SEARCH_POSITION, false);
setSelectedBottomBarMenuItem(org.smartregister.child.R.id.action_search);
} catch (Exception e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import java.util.Set;

import timber.log.Timber;
import com.google.firebase.crashlytics.FirebaseCrashlytics;

public abstract class BaseAdvancedSearchFragment extends BaseChildRegisterFragment
implements ChildAdvancedSearchContract.View, ChildRegisterFragmentContract.View, View.OnClickListener {
Expand Down Expand Up @@ -213,7 +214,7 @@ protected void recordService(String openSrpId) {
ChildJsonFormUtils.getProviderLocationId(requireContext()));
} catch (Exception e) {
Utils.showShortToast(requireActivity(), getString(R.string.error_recording_out_of_catchment_service));
Timber.e(e, "Error recording Out of Catchment Service");
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e, "Error recording Out of Catchment Service");
}
}

Expand Down Expand Up @@ -332,7 +333,7 @@ public void afterTextChanged(Editable editable) {
if (StringUtils.isNoneBlank(editable))
endDateDatePicker.getDatePickerDialog().setMinDate(dateFormatter.parse(editable.toString()).getTime());
} catch (ParseException e) {
Timber.e(e, "Error setting end date minimum to start date");
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e, "Error setting end date minimum to start date");
}
startDate.setError(null);
}
Expand Down Expand Up @@ -642,7 +643,7 @@ public void countExecute() {
clientAdapter.setCurrentlimit(20);
clientAdapter.setCurrentoffset(0);
} catch (Exception e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}

updateMatchingResults(clientAdapter.getTotalcount());
Expand All @@ -668,7 +669,7 @@ public String filterAndSortQuery() {
query = sqb.Endquery(
sqb.addlimitandOffset(query, clientAdapter.getCurrentlimit(), clientAdapter.getCurrentoffset()));
} catch (Exception e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}

return query;
Expand Down Expand Up @@ -739,7 +740,7 @@ public void onClick(View view) {
try {
currentDate.setTime(dateFormatter.parse(previousDateString));
} catch (ParseException e) {
Timber.e(e, "Error parsing Advance Search Date: %s", e.getMessage());
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e, "Error parsing Advance Search Date: %s", e.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import java.util.Set;

import timber.log.Timber;
import com.google.firebase.crashlytics.FirebaseCrashlytics;

/**
* Created by ndegwamartin on 25/02/2019.
Expand Down Expand Up @@ -284,7 +285,7 @@ protected void updateLocationText() {
getOpenSRPContext().allSharedPreferences().savePreference(Constants.CURRENT_LOCATION_ID, locationId);
}
} catch (Exception e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}
}

Expand All @@ -301,12 +302,14 @@ protected void updateDueOverdueCountText() {
overdueCountTV.setText(String.valueOf(overDueCount));
overdueCountTV.setVisibility(View.VISIBLE);
overdueCountTV.setClickable(true);
filterSection.setVisibility(View.VISIBLE);
} else {
overdueCountTV.setVisibility(View.GONE);
overdueCountTV.setClickable(false);
filterSection.setVisibility(View.INVISIBLE);
}
} else {
Timber.e("Over Due Count Text View (overdueCountTV) is NULL ...whyyy?");
FirebaseCrashlytics.getInstance().recordException(new Exception("Over Due Count Text View (overdueCountTV) is NULL ...whyyy?")); Timber.e("Over Due Count Text View (overdueCountTV) is NULL ...whyyy?");
}
}

Expand Down Expand Up @@ -412,7 +415,7 @@ protected String filterAndSortQuery() {
return query;
}
} catch (Exception e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}

return query;
Expand All @@ -437,7 +440,7 @@ public void countExecute() {
overDueCount = commonRepository().countSearchIds(sqlOverdueCount);
Timber.i("Total Overdue Count %d", overDueCount);
} catch (Exception e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.util.Map;

import timber.log.Timber;
import com.google.firebase.crashlytics.FirebaseCrashlytics;

/**
* Created by ndegwamartin on 06/03/2019.
Expand Down Expand Up @@ -85,7 +86,7 @@ public void onCreate(Bundle savedInstanceState) {
try {
super.onCreate(savedInstanceState);
} catch (IllegalStateException e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}
Form form = getForm();
setFields(form.getStep1().getFields());
Expand Down Expand Up @@ -147,7 +148,7 @@ protected Form getForm() {
return AssetHandler.jsonStringToJava(jsonString, Form.class);
}
} catch (Exception e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import timber.log.Timber;

import static org.smartregister.util.Utils.getValue;
import com.google.firebase.crashlytics.FirebaseCrashlytics;

/**
* Created by ndegwamartin on 01/03/2019.
Expand Down Expand Up @@ -414,7 +415,7 @@ private String getCurrentFieldValue(Map<String, String> columnMaps, String field
try {
value = mlsLookupDateFormatter.format(motherDob);
} catch (Exception e) {
Timber.e(e, e.toString());
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e, e.toString());
}
}
}
Expand Down Expand Up @@ -491,7 +492,7 @@ private void setSpinnerValue(String value, ViewGroup spinnerViewGroup) {
spinner.setEnabled(false);
}
} catch (JSONException e) {
Timber.e(e);
FirebaseCrashlytics.getInstance().recordException(e); Timber.e(e);
}
}

Expand Down
Loading