altosdroid: Centralize debug printf code
[fw/altos] / altosdroid / src / org / altusmetrum / AltosDroid / TelemetryLogger.java
index 0cd9b2c139bed1fb646b9cc0131eea622cc8e003..7c3c2268c0ae8bf70d59ce7d654d7bfa09130eae 100644 (file)
@@ -7,12 +7,8 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.os.Environment;
-import android.util.Log;
 
 public class TelemetryLogger {
-       private static final String TAG = "TelemetryLogger";
-       private static final boolean D = true;
-
        private Context   context = null;
        private AltosLink link    = null;
        private AltosLog  logger  = null;
@@ -33,7 +29,7 @@ public class TelemetryLogger {
 
        private void close() {
                if (logger != null) {
-                       if (D) Log.d(TAG, "Shutting down Telemetry Logging");
+                       AltosDebug.debug("Shutting down Telemetry Logging");
                        logger.close();
                        logger = null;
                }
@@ -43,11 +39,11 @@ public class TelemetryLogger {
                String state = Environment.getExternalStorageState();
                if (Environment.MEDIA_MOUNTED.equals(state)) {
                        if (logger == null) {
-                               if (D) Log.d(TAG, "Starting up Telemetry Logging");
+                               AltosDebug.debug("Starting up Telemetry Logging");
                                logger = new AltosLog(link);
                        }
                } else {
-                       if (D) Log.d(TAG, "External Storage not present - stopping");
+                       AltosDebug.debug("External Storage not present - stopping");
                        close();
                }
        }