From abd7625869e302c94d149ab42e804d2d8a2d4d17 Mon Sep 17 00:00:00 2001 From: Brett Chabot Date: Wed, 29 Jan 2014 19:46:42 -0800 Subject: Stem TestLoader log spam. Change-Id: Ib7e9cac82593516d9c42ed4d423f77e342236fa0 --- .../android/support/test/internal/runner/TestLoader.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/support/src/android/support/test/internal/runner/TestLoader.java b/support/src/android/support/test/internal/runner/TestLoader.java index a1c93ef..66b0bd3 100644 --- a/support/src/android/support/test/internal/runner/TestLoader.java +++ b/support/src/android/support/test/internal/runner/TestLoader.java @@ -134,7 +134,7 @@ public class TestLoader { private boolean isTestClass(Class loadedClass) { try { if (Modifier.isAbstract(loadedClass.getModifiers())) { - Log.v(LOG_TAG, String.format("Skipping abstract class %s: not a test", + logDebug(String.format("Skipping abstract class %s: not a test", loadedClass.getName())); return false; } @@ -151,7 +151,7 @@ public class TestLoader { return true; } } - Log.v(LOG_TAG, String.format("Skipping class %s: not a test", loadedClass.getName())); + logDebug(String.format("Skipping class %s: not a test", loadedClass.getName())); return false; } catch (Exception e) { // Defensively catch exceptions - Will throw runtime exception if it cannot load methods. @@ -168,6 +168,16 @@ public class TestLoader { Log.w(LOG_TAG, String.format("%s in isTestClass for %s", e.toString(), loadedClass.getName())); return false; - } + } + } + + /** + * Utility method for logging debug messages. Only actually logs a message if LOG_TAG is marked + * as loggable to limit log spam during normal use. + */ + private void logDebug(String msg) { + if (Log.isLoggable(LOG_TAG, Log.DEBUG)) { + Log.d(LOG_TAG, msg); + } } } -- cgit v1.2.3