mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
enroll more logging in feddback system
This commit is contained in:
parent
1e07b8a34c
commit
31ba0116ac
7 changed files with 16 additions and 14 deletions
|
@ -59,7 +59,7 @@ public class NbActivity extends Activity {
|
|||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
if (AppConstants.VERBOSE_LOG) Log.d(this.getClass().getName(), "onResume");
|
||||
com.newsblur.util.Log.d(this.getClass().getName(), "onResume" + UIUtils.getMemoryUsageDebug(this));
|
||||
super.onResume();
|
||||
finishIfNotLoggedIn();
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class NbActivity extends Activity {
|
|||
protected void finishIfNotLoggedIn() {
|
||||
String currentLoginKey = PrefsUtils.getUniqueLoginKey(this);
|
||||
if(currentLoginKey == null || !currentLoginKey.equals(uniqueLoginKey)) {
|
||||
Log.d( this.getClass().getName(), "This activity was for a different login. finishing it.");
|
||||
com.newsblur.util.Log.d( this.getClass().getName(), "This activity was for a different login. finishing it.");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class APIManager {
|
|||
public LoginResponse login(final String username, final String password) {
|
||||
// This call should be pretty rare, but is expensive on the server side. Log it
|
||||
// at an above-debug level so it will be noticed if it ever gets called too often.
|
||||
Log.i(this.getClass().getName(), "calling login API");
|
||||
com.newsblur.util.Log.i(this.getClass().getName(), "calling login API");
|
||||
final ContentValues values = new ContentValues();
|
||||
values.put(APIConstants.PARAMETER_USERNAME, username);
|
||||
values.put(APIConstants.PARAMETER_PASSWORD, password);
|
||||
|
@ -111,7 +111,7 @@ public class APIManager {
|
|||
ContentValues values = new ContentValues();
|
||||
values.put(APIConstants.PARAMETER_USER, username);
|
||||
String urlString = buildUrl(APIConstants.PATH_LOGINAS) + "?" + builderGetParametersString(values);
|
||||
Log.i(this.getClass().getName(), "doing superuser swap: " + urlString);
|
||||
com.newsblur.util.Log.i(this.getClass().getName(), "doing superuser swap: " + urlString);
|
||||
// This API returns a redirect that means the call worked, but we do not want to follow it. To
|
||||
// just get the cookie from the 302 and stop, we directly use a one-off OkHttpClient.
|
||||
Request.Builder requestBuilder = new Request.Builder().url(urlString);
|
||||
|
@ -692,13 +692,13 @@ public class APIManager {
|
|||
*/
|
||||
private void backoffSleep(int tryCount) {
|
||||
if (tryCount == 0) return;
|
||||
Log.i(this.getClass().getName(), "API call failed, pausing before retry number " + tryCount);
|
||||
com.newsblur.util.Log.i(this.getClass().getName(), "API call failed, pausing before retry number " + tryCount);
|
||||
try {
|
||||
// simply double the base sleep time for each subsequent try
|
||||
long factor = Math.round(Math.pow(2.0d, tryCount));
|
||||
Thread.sleep(AppConstants.API_BACKOFF_BASE_MILLIS * factor);
|
||||
} catch (InterruptedException ie) {
|
||||
Log.w(this.getClass().getName(), "Abandoning API backoff due to interrupt.");
|
||||
com.newsblur.util.Log.w(this.getClass().getName(), "Abandoning API backoff due to interrupt.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ public class APIResponse {
|
|||
* Construct and empty/offline response. Signals that the call was not made.
|
||||
*/
|
||||
public APIResponse(Context context) {
|
||||
com.newsblur.util.Log.w(this.getClass().getName(), "failing an offline API response");
|
||||
this.isError = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,24 +20,24 @@ public class CleanupService extends SubService {
|
|||
|
||||
gotWork();
|
||||
|
||||
if (AppConstants.VERBOSE_LOG) Log.d(this.getClass().getName(), "cleaning up old stories");
|
||||
com.newsblur.util.Log.d(this.getClass().getName(), "cleaning up old stories");
|
||||
parent.dbHelper.cleanupVeryOldStories();
|
||||
if (!PrefsUtils.isKeepOldStories(parent)) {
|
||||
parent.dbHelper.cleanupReadStories();
|
||||
}
|
||||
|
||||
if (AppConstants.VERBOSE_LOG) Log.d(this.getClass().getName(), "cleaning up old story texts");
|
||||
com.newsblur.util.Log.d(this.getClass().getName(), "cleaning up old story texts");
|
||||
parent.dbHelper.cleanupStoryText();
|
||||
|
||||
if (AppConstants.VERBOSE_LOG) Log.d(this.getClass().getName(), "cleaning up story image cache");
|
||||
com.newsblur.util.Log.d(this.getClass().getName(), "cleaning up story image cache");
|
||||
FileCache imageCache = FileCache.asStoryImageCache(parent);
|
||||
imageCache.cleanupUnusedOrOld(parent.dbHelper.getAllStoryImages());
|
||||
|
||||
if (AppConstants.VERBOSE_LOG) Log.d(this.getClass().getName(), "cleaning up icon cache");
|
||||
com.newsblur.util.Log.d(this.getClass().getName(), "cleaning up icon cache");
|
||||
FileCache iconCache = FileCache.asIconCache(parent);
|
||||
iconCache.cleanupOld();
|
||||
|
||||
if (AppConstants.VERBOSE_LOG) Log.d(this.getClass().getName(), "cleaning up thumbnail cache");
|
||||
com.newsblur.util.Log.d(this.getClass().getName(), "cleaning up thumbnail cache");
|
||||
FileCache thumbCache = FileCache.asThumbnailCache(parent);
|
||||
thumbCache.cleanupUnusedOrOld(parent.dbHelper.getAllStoryThumbnails());
|
||||
|
||||
|
|
|
@ -971,6 +971,7 @@ public class NBSyncService extends Service {
|
|||
* session gets cleared before the next one is populated.
|
||||
*/
|
||||
public static void resetReadingSession() {
|
||||
com.newsblur.util.Log.d(NBSyncService.class.getName(), "requesting reading session reset");
|
||||
synchronized (PENDING_FEED_MUTEX) {
|
||||
PendingFeed = null;
|
||||
ResetSession = true;
|
||||
|
|
|
@ -58,7 +58,7 @@ public abstract class SubService {
|
|||
//if (AppConstants.VERBOSE_LOG) Log.d(this.getClass().getName(), "SubService completed");
|
||||
cycleStartTime = 0;
|
||||
} catch (Exception e) {
|
||||
Log.e(this.getClass().getName(), "Sync error.", e);
|
||||
com.newsblur.util.Log.e(this.getClass().getName(), "Sync error.", e);
|
||||
} finally {
|
||||
if (isRunning()) {
|
||||
setRunning(false);
|
||||
|
@ -116,7 +116,7 @@ public abstract class SubService {
|
|||
if (cooloffTimeMs > AppConstants.DUTY_CYCLE_BACKOFF_CAP_MILLIS) cooloffTimeMs = AppConstants.DUTY_CYCLE_BACKOFF_CAP_MILLIS;
|
||||
|
||||
if (NbActivity.getActiveActivityCount() > 0 ) {
|
||||
if (AppConstants.VERBOSE_LOG) Log.d(this.getClass().getName(), "Sleeping for : " + cooloffTimeMs + "ms to enforce max duty cycle.");
|
||||
com.newsblur.util.Log.d(this.getClass().getName(), "Sleeping for : " + cooloffTimeMs + "ms to enforce max duty cycle.");
|
||||
try {
|
||||
Thread.sleep(cooloffTimeMs);
|
||||
} catch (InterruptedException e) {
|
||||
|
|
|
@ -62,7 +62,7 @@ public class PrefsUtils {
|
|||
|
||||
String oldVersion = prefs.getString(AppConstants.LAST_APP_VERSION, null);
|
||||
if ( (oldVersion == null) || (!oldVersion.equals(version)) ) {
|
||||
Log.i(PrefsUtils.class.getName(), "detected new version of app:" + version);
|
||||
com.newsblur.util.Log.i(PrefsUtils.class.getName(), "detected new version of app:" + version);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue