Skip to content

Commit

Permalink
Use isLoggable to restrict excess logging at possible hotspot
Browse files Browse the repository at this point in the history
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
rtyley committed Apr 16, 2012
1 parent 19a284a commit 5ea8a3e
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 5ea8a3e

Please sign in to comment.