diff options
author | Brett Chabot <brettchabot@google.com> | 2014-01-29 19:46:42 -0800 |
---|---|---|
committer | Brett Chabot <brettchabot@google.com> | 2014-02-03 12:22:27 -0800 |
commit | abd7625869e302c94d149ab42e804d2d8a2d4d17 (patch) | |
tree | 7d55a7a0a0f15b82b2aeea2f097051fb1c616d61 | |
parent | e696b968bfe7521fe8c6623dbc466adb9b4302c9 (diff) | |
download | testing-abd7625869e302c94d149ab42e804d2d8a2d4d17.tar.gz |
Stem TestLoader log spam.
Change-Id: Ib7e9cac82593516d9c42ed4d423f77e342236fa0
-rw-r--r-- | support/src/android/support/test/internal/runner/TestLoader.java | 16 |
1 files 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); + } } } |