diff options
author | Alan Newberger <alann@google.com> | 2014-04-07 18:03:08 -0700 |
---|---|---|
committer | Ed Heyl <edheyl@google.com> | 2014-06-18 10:24:45 -0700 |
commit | b52fe84c71ddcf1313c4112393bb4936442d9f13 (patch) | |
tree | 595b0f6783aed10d9398ee86954072a60313c8ab /camera2/portability/src/com/android/ex/camera2 | |
parent | 102540727e51003c352e82349c339929a0c4be7e (diff) | |
download | android_frameworks_ex-b52fe84c71ddcf1313c4112393bb4936442d9f13.tar.gz android_frameworks_ex-b52fe84c71ddcf1313c4112393bb4936442d9f13.tar.bz2 android_frameworks_ex-b52fe84c71ddcf1313c4112393bb4936442d9f13.zip |
Replace isDebugging compiletime logging override with runtime property
This CL accomplishes the same goal as the compile-time isDebuggable,
with a runtime property check. This is useful so that we opt in to
logging everything at a given level with one setprop line.
Note that either with this new runtime property or with isDebuggable,
the Log proxy wouldn't log if a particular Configuration value is false,
since that level is instead routed to SILENT_LOGGER.
Bug: 13737123
Change-Id: I78ce629620f420a08a2cc013865847674941fb9b
Diffstat (limited to 'camera2/portability/src/com/android/ex/camera2')
-rw-r--r-- | camera2/portability/src/com/android/ex/camera2/portability/debug/Log.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/camera2/portability/src/com/android/ex/camera2/portability/debug/Log.java b/camera2/portability/src/com/android/ex/camera2/portability/debug/Log.java index daac7e6..4cfe87a 100644 --- a/camera2/portability/src/com/android/ex/camera2/portability/debug/Log.java +++ b/camera2/portability/src/com/android/ex/camera2/portability/debug/Log.java @@ -17,6 +17,15 @@ package com.android.ex.camera2.portability.debug; public class Log { + /** + * All Camera logging using this class will use this tag prefix. + * Additionally, the prefix itself is checked in isLoggable and + * serves as an override. So, to toggle all logs allowed by the + * current {@link Configuration}, you can set properties: + * + * adb shell setprop log.tag.CAM2PORT_ VERBOSE + * adb shell setprop log.tag.CAM2PORT_ "" + */ public static final String CAMERA_LOGTAG_PREFIX = "CAM2PORT_"; private static final Log.Tag TAG = new Log.Tag("Log"); @@ -196,8 +205,9 @@ public class Log { private static boolean isLoggable(Tag tag, int level) { try { - return CurrentConfig.get().isDebugging() - || android.util.Log.isLoggable(tag.toString(), level); + // The prefix can be used as an override tag to see all camera logs + return android.util.Log.isLoggable(CAMERA_LOGTAG_PREFIX, level) + || android.util.Log.isLoggable(tag.toString(), level); } catch (IllegalArgumentException ex) { e(TAG, "Tag too long:" + tag); return false; |