From 542dbaf7b1dace955421515ff3deeb26c037a09d Mon Sep 17 00:00:00 2001 From: "Rui Zhao (renyuneyun)" Date: Mon, 19 Feb 2018 23:43:40 +0000 Subject: [PATCH] Better debugging messages (including fix to forgotten item) --- app/src/main/java/ryey/easer/core/EHService.java | 2 +- app/src/main/java/ryey/easer/core/Lotus.java | 7 ++++--- .../java/ryey/easer/core/ProfileLoaderIntentService.java | 7 ++++--- app/src/main/java/ryey/easer/core/ui/MainActivity.java | 4 ---- .../easer/plugins/operation/broadcast/BroadcastLoader.java | 2 -- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/ryey/easer/core/EHService.java b/app/src/main/java/ryey/easer/core/EHService.java index 289f3b72..56eeb888 100644 --- a/app/src/main/java/ryey/easer/core/EHService.java +++ b/app/src/main/java/ryey/easer/core/EHService.java @@ -115,7 +115,7 @@ public static long getLoadTime() { @Override public void onCreate() { - Logger.v("onCreate"); + Logger.v("EHService onCreate()"); running = true; Intent intent = new Intent(ACTION_STATE_CHANGED); sendBroadcast(intent); diff --git a/app/src/main/java/ryey/easer/core/Lotus.java b/app/src/main/java/ryey/easer/core/Lotus.java index a3f756d2..8c918b7d 100644 --- a/app/src/main/java/ryey/easer/core/Lotus.java +++ b/app/src/main/java/ryey/easer/core/Lotus.java @@ -178,17 +178,18 @@ synchronized void setStatus(boolean status) { private synchronized void onSlotSatisfied() { if (!repeatable && satisfied) return; - Logger.i("event <%s> satisfied", eventTree.getName()); + final String eventName = eventTree.getName(); + Logger.i("event <%s> satisfied", eventName); satisfied = true; if (cooldownInMillisecond > 0) { Calendar now = Calendar.getInstance(); if (lastSatisfied != null) { if (now.getTimeInMillis() - lastSatisfied.getTimeInMillis() < cooldownInMillisecond) { - Logger.d("event <%s> is within cooldown time"); + Logger.d("event <%s> is within cooldown time", eventName); return; } } - Logger.d("event <%s> is not within cooldown time"); + Logger.d("event <%s> is not within cooldown time", eventName); lastSatisfied = now; } if (mSlot.canPromoteSub()) { diff --git a/app/src/main/java/ryey/easer/core/ProfileLoaderIntentService.java b/app/src/main/java/ryey/easer/core/ProfileLoaderIntentService.java index 170f275d..64efd211 100644 --- a/app/src/main/java/ryey/easer/core/ProfileLoaderIntentService.java +++ b/app/src/main/java/ryey/easer/core/ProfileLoaderIntentService.java @@ -48,22 +48,23 @@ public ProfileLoaderIntentService() { @Override public void onCreate() { - Logger.v("onCreate()"); + Logger.v("ProfileLoaderIntentService onCreate()"); super.onCreate(); } @Override protected void onHandleIntent(Intent intent) { if (intent == null) { - Logger.wtf("Handling null intent"); + Logger.wtf("ProfileLoaderIntentService got null Intent to handle"); return; } final String action = intent.getAction(); - Logger.v("Handling intent with action <%s>", action); if (ACTION_LOAD_PROFILE.equals(action)) { final String name = intent.getStringExtra(EXTRA_PROFILE_NAME); final String event = intent.getStringExtra(EXTRA_EVENT_NAME); handleActionLoadProfile(name, event); + } else { + Logger.wtf("ProfileLoaderIntentService got unknown Intent action <%s>", action); } } diff --git a/app/src/main/java/ryey/easer/core/ui/MainActivity.java b/app/src/main/java/ryey/easer/core/ui/MainActivity.java index 8209755d..fc53943e 100644 --- a/app/src/main/java/ryey/easer/core/ui/MainActivity.java +++ b/app/src/main/java/ryey/easer/core/ui/MainActivity.java @@ -38,8 +38,6 @@ import android.view.MenuItem; import android.widget.TextView; -import com.orhanobut.logger.Logger; - import ryey.easer.R; import ryey.easer.core.data.storage.StorageHelper; import ryey.easer.core.ui.edit.EventListFragment; @@ -133,8 +131,6 @@ public void onBackPressed() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { - Logger.v("item: " + item.getTitle()); - int id = item.getItemId(); FragmentManager manager = getSupportFragmentManager(); Fragment fragment; diff --git a/app/src/main/java/ryey/easer/plugins/operation/broadcast/BroadcastLoader.java b/app/src/main/java/ryey/easer/plugins/operation/broadcast/BroadcastLoader.java index f706a15f..76d30755 100644 --- a/app/src/main/java/ryey/easer/plugins/operation/broadcast/BroadcastLoader.java +++ b/app/src/main/java/ryey/easer/plugins/operation/broadcast/BroadcastLoader.java @@ -25,8 +25,6 @@ import android.os.Bundle; import android.support.annotation.NonNull; -import com.orhanobut.logger.Logger; - import java.util.ArrayList; import ryey.easer.Utils;