Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use isLoggable to restrict excess logging at possible hotspot

Note that if you actually *do* want to see these log messages, you need
to use 'adb' to enable the log level:

adb shell setprop log.tag.RTS DEBUG
  • Loading branch information...
commit 5ea8a3ef65cdca544a42e9f4ae9c39e073397f14 1 parent 19a284a
@rtyley rtyley authored
View
8 app/src/main/java/com/github/mobile/gauges/realtime/RealtimeTrafficService.java
@@ -17,6 +17,8 @@
package com.github.mobile.gauges.realtime;
+import static android.util.Log.DEBUG;
+import static android.util.Log.isLoggable;
import static com.github.mobile.gauges.authenticator.AuthConstants.AUTHTOKEN_TYPE;
import static com.github.mobile.gauges.authenticator.AuthConstants.GAUGES_ACCOUNT_TYPE;
import static java.util.concurrent.Executors.newFixedThreadPool;
@@ -121,8 +123,10 @@ public GaugesService get() {
}
void broadcast(Hit hit, Gauge gauge) {
- long views = gauge.getToday().getViews();
- Log.d(TAG, "Broadcasting '" + gauge.getTitle() + "' views=" + views + " to " + hitListeners.size());
+ if (isLoggable(TAG, DEBUG)) {
+ long views = gauge.getToday().getViews();
+ Log.d(TAG, "Broadcasting '" + gauge.getTitle() + "' views=" + views + " to " + hitListeners.size());
+ }
for (HitListener hitListener : hitListeners.keySet())
hitListener.observe(hit, gauge);
}
Please sign in to comment.
Something went wrong with that request. Please try again.