Skip to content

Commit c9effff

Browse files
committed
Remove extra logs
* Remove redundant logs from setAppId and initWithContext
1 parent 83f8857 commit c9effff

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

OneSignalSDK/onesignal/src/main/java/com/onesignal/OneSignal.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -554,26 +554,23 @@ public void run() {
554554
* @param newAppId - String app id associated with the OneSignal dashboard app
555555
*/
556556
public static void setAppId(@NonNull String newAppId) {
557-
logger.verbose("setAppId(id) called with app_id: " + newAppId + "!");
558-
559557
if (newAppId == null || newAppId.isEmpty()) {
560-
logger.warning("newAppId is null or empty, ignoring!");
558+
logger.warning("setAppId called with id: " + newAppId + ", ignoring!");
561559
return;
562560
} else if (!newAppId.equals(appId)) {
563561
// Pre-check on app id to make sure init of SDK is performed properly
564562
// Usually when the app id is changed during runtime so that SDK is reinitialized properly
565563
initDone = false;
564+
logger.verbose("setAppId called with id: " + newAppId + " changing id from: " + appId);
566565
}
567566

568567
appId = newAppId;
569568

570-
logger.verbose("setAppId(id) finished, checking if appContext has been set before proceeding...");
571569
if (appContext == null) {
572570
logger.warning("appId set, but please call initWithContext(appContext) with Application context to complete OneSignal init!");
573571
return;
574572
}
575573

576-
logger.verbose("setAppId(id) successful and appContext is set, continuing OneSignal init...");
577574
init(appContext);
578575
}
579576

@@ -585,10 +582,8 @@ public static void setAppId(@NonNull String newAppId) {
585582
* @param context - Context used by the Application of the app
586583
*/
587584
public static void initWithContext(@NonNull Context context) {
588-
logger.verbose("initWithContext(context) called!");
589-
590585
if (context == null) {
591-
Log(LOG_LEVEL.WARN, "context is null, ignoring!");
586+
logger.warning("initWithContext called with null context, ignoring!");
592587
return;
593588
}
594589

@@ -597,19 +592,19 @@ public static void initWithContext(@NonNull Context context) {
597592
setupActivityLifecycleListener(wasAppContextNull);
598593
setupPrivacyConsent(appContext);
599594

600-
logger.verbose("initWithContext(context) finished, checking if appId has been set before proceeding...");
601595
if (appId == null) {
602596
// Get the cached app id, if it exists
603597
String oldAppId = getSavedAppId();
604598
if (oldAppId == null) {
605599
logger.warning("appContext set, but please call setAppId(appId) with a valid appId to complete OneSignal init!");
606600
} else {
607-
logger.verbose("appContext set and an old appId was found, attempting to call setAppId(oldAppId)");
601+
logger.verbose("appContext set and cached app id found, calling setAppId with: " + oldAppId);
608602
setAppId(oldAppId);
609603
}
610604
return;
605+
} else {
606+
logger.verbose("initWithContext called with: " + context);
611607
}
612-
logger.verbose("initWithContext(context) successful and appId is set, continuing OneSignal init...");
613608
init(context);
614609
}
615610

@@ -637,6 +632,7 @@ public static void setInAppMessageClickHandler(@Nullable OSInAppMessageClickHand
637632
* Called after setAppId and initWithContext, depending on which one is called last (order does not matter)
638633
*/
639634
synchronized private static void init(Context context) {
635+
logger.verbose("Starting OneSignal initialization!");
640636
OSNotificationController.setupNotificationServiceExtension(appContext);
641637

642638
if (requiresUserPrivacyConsent() || !remoteParamController.isRemoteParamsCallDone()) {

0 commit comments

Comments
 (0)