Skip to content

Commit

Permalink
Merge pull request #898 from Microsoft/fix/network-logs
Browse files Browse the repository at this point in the history
Fix disabling network state logs when debug logs disabled
  • Loading branch information
guperrot committed Nov 29, 2018
2 parents f73654a + faafb47 commit e1a33b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* **[Fix]** Do not delete old logs when trying to add a log larger than the maximum storage capacity.
* **[Fix]** Fix error detection of `setMaxStorageSize` API if database uses custom page size.
* **[Fix]** Fix minimum storage size verification to match minimum possible value.
* **[Fix]** Fix disabling logging of network state changes according to `AppCenter.getLogLevel`.

### AppCenterCrashes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.VisibleForTesting;
import android.util.Log;

import com.microsoft.appcenter.AppCenter;

Expand All @@ -22,7 +21,7 @@
import java.util.Set;

import static android.content.Context.CONNECTIVITY_SERVICE;
import static com.microsoft.appcenter.utils.AppCenterLog.LOG_TAG;
import static com.microsoft.appcenter.AppCenter.LOG_TAG;

/**
* Network state helper.
Expand Down Expand Up @@ -157,9 +156,9 @@ public synchronized boolean isNetworkConnected() {
* Handle network available update on API level >= 21.
*/
private synchronized void onNetworkAvailable(Network network) {
Log.d(AppCenter.LOG_TAG, "Network available netId: " + network);
AppCenterLog.debug(LOG_TAG, "Network available netId: " + network);
mAvailableNetworks.add(network);
Log.d(AppCenter.LOG_TAG, "Available networks netIds: " + mAvailableNetworks);
AppCenterLog.debug(LOG_TAG, "Available networks netIds: " + mAvailableNetworks);

/*
* Trigger event only once if we gain a new network while one was already
Expand All @@ -183,9 +182,9 @@ private synchronized void onNetworkLost(Network network) {
* and fast. This notification scheme is similar to the old connectivity receiver
* implementation.
*/
Log.d(AppCenter.LOG_TAG, "Network lost netId: " + network);
AppCenterLog.debug(LOG_TAG, "Network lost netId: " + network);
mAvailableNetworks.remove(network);
Log.d(AppCenter.LOG_TAG, "Available networks netIds: " + mAvailableNetworks);
AppCenterLog.debug(LOG_TAG, "Available networks netIds: " + mAvailableNetworks);
notifyNetworkStateUpdated(false);
if (!mAvailableNetworks.isEmpty()) {
notifyNetworkStateUpdated(true);
Expand Down

0 comments on commit e1a33b2

Please sign in to comment.