Skip to content

Commit

Permalink
Improved logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtursKadikis committed Jun 12, 2018
1 parent 3d6c06e commit bd37799
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions sdk/src/main/java/ly/count/android/sdk/Countly.java
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public synchronized Countly init(final Context context, String serverURL, final
int starRatingLimit, CountlyStarRating.RatingCallback starRatingCallback, String starRatingTextTitle, String starRatingTextMessage, String starRatingTextDismiss) {

if (context == null) {
throw new IllegalArgumentException("valid context is required");
throw new IllegalArgumentException("valid context is required in Countly init, but was provided 'null'");
}

if (!isValidURL(serverURL)) {
Expand All @@ -301,10 +301,10 @@ public synchronized Countly init(final Context context, String serverURL, final
}

if (appKey == null || appKey.length() == 0) {
throw new IllegalArgumentException("valid appKey is required");
throw new IllegalArgumentException("valid appKey is required, but was provided either 'null' or empty String");
}
if (deviceID != null && deviceID.length() == 0) {
throw new IllegalArgumentException("valid deviceID is required");
throw new IllegalArgumentException("valid deviceID is required, but was provided either 'null' or empty String");
}
if (deviceID == null && idMode == null) {
if (OpenUDIDAdapter.isOpenUDIDAvailable()) idMode = DeviceId.Type.OPEN_UDID;
Expand All @@ -324,10 +324,27 @@ public synchronized Countly init(final Context context, String serverURL, final

if (Countly.sharedInstance().isLoggingEnabled()) {
Log.d(Countly.TAG, "Initializing Countly SDk version " + COUNTLY_SDK_VERSION_STRING);
}

if (Countly.sharedInstance().isLoggingEnabled()) {
Log.d(Countly.TAG, "Is consent required? [" + requiresConsent + "]");

// Context class hierarchy
//Context
//| — ContextWrapper
//|— — Application
//| — — ContextThemeWrapper
//|— — — — Activity
//| — — Service
//|— — — IntentService

Class contextClass = context.getClass();
Class contextSuperClass = contextClass.getSuperclass();

String contextText = "Provided Context [" + context.getClass().getSimpleName() + "]";
if(contextSuperClass != null){
contextText += ", it's superclass: [" + contextSuperClass.getSimpleName() + "]";
}

Log.d(Countly.TAG, contextText);

}

// In some cases CountlyMessaging does some background processing, so it needs a way
Expand Down

0 comments on commit bd37799

Please sign in to comment.