summaryrefslogtreecommitdiffstats
path: root/logcat
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2014-04-01 17:19:47 -0700
committerMark Salyzyn <salyzyn@google.com>2014-04-02 13:12:04 -0700
commit1c950479393d42d18829d4009dbdb3a7f03acbb7 (patch)
tree1ba86b1f06f7df22e46ed2c022685fd71589d1bc /logcat
parent223fc42b5e289e882f67c893374ffbef595a6901 (diff)
downloadsystem_core-1c950479393d42d18829d4009dbdb3a7f03acbb7.zip
system_core-1c950479393d42d18829d4009dbdb3a7f03acbb7.tar.gz
system_core-1c950479393d42d18829d4009dbdb3a7f03acbb7.tar.bz2
logd: liblog: logcat: enable prune features for user
- Enable whitelist, blacklist and logsize tuneables for user Change-Id: Id0c283844c71c5263a8cfbebf2e550f7ac415858
Diffstat (limited to 'logcat')
-rw-r--r--logcat/Android.mk4
-rw-r--r--logcat/logcat.cpp47
-rw-r--r--logcat/tests/Android.mk4
-rw-r--r--logcat/tests/logcat_test.cpp2
4 files changed, 4 insertions, 53 deletions
diff --git a/logcat/Android.mk b/logcat/Android.mk
index dd15cb3..b5e27eb 100644
--- a/logcat/Android.mk
+++ b/logcat/Android.mk
@@ -3,10 +3,6 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-ifneq ($(filter userdebug eng,$(TARGET_BUILD_VARIANT)),)
-LOCAL_CFLAGS += -DUSERDEBUG_BUILD=1
-endif
-
LOCAL_SRC_FILES:= logcat.cpp event.logtags
LOCAL_SHARED_LIBRARIES := liblog
diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp
index 5a80efe..00a60bd 100644
--- a/logcat/logcat.cpp
+++ b/logcat/logcat.cpp
@@ -232,17 +232,10 @@ static void show_help(const char *cmd)
" -B output the log in binary.\n"
" -S output statistics.\n");
-#ifdef USERDEBUG_BUILD
-
- fprintf(stderr, "--------------------- eng & userdebug builds only ---------------------------\n"
- " -G <count> set size of log's ring buffer and exit\n"
+ fprintf(stderr, " -G <count> set size of log's ring buffer and exit\n"
" -p output prune white and ~black list\n"
" -P '<list> ...' set prune white and ~black list; UID, /PID or !(worst UID)\n"
- " default is ~!, prune worst UID.\n"
- "-----------------------------------------------------------------------------\n"
- );
-
-#endif
+ " default is ~!, prune worst UID.\n");
fprintf(stderr,"\nfilterspecs are a series of \n"
" <tag>[:priority]\n\n"
@@ -291,11 +284,9 @@ int main(int argc, char **argv)
int hasSetLogFormat = 0;
int clearLog = 0;
int getLogSize = 0;
-#ifdef USERDEBUG_BUILD
unsigned long setLogSize = 0;
int getPruneList = 0;
char *setPruneList = NULL;
-#endif
int printStatistics = 0;
int mode = O_RDONLY;
const char *forceFilters = NULL;
@@ -323,13 +314,7 @@ int main(int argc, char **argv)
for (;;) {
int ret;
- ret = getopt(argc, argv,
-#ifdef USERDEBUG_BUILD
- "cdt:T:gG:sQf:r::n:v:b:BSpP:"
-#else
- "cdt:T:gsQf:r::n:v:b:BS"
-#endif
- );
+ ret = getopt(argc, argv, "cdt:T:gG:sQf:r::n:v:b:BSpP:");
if (ret < 0) {
break;
@@ -386,8 +371,6 @@ int main(int argc, char **argv)
getLogSize = 1;
break;
-#ifdef USERDEBUG_BUILD
-
case 'G': {
// would use atol if not for the multiplier
char *cp = optarg;
@@ -433,8 +416,6 @@ int main(int argc, char **argv)
setPruneList = optarg;
break;
-#endif
-
case 'b': {
if (strcmp(optarg, "all") == 0) {
while (devices) {
@@ -704,15 +685,11 @@ int main(int argc, char **argv)
}
}
-#ifdef USERDEBUG_BUILD
-
if (setLogSize && android_logger_set_log_size(dev->logger, setLogSize)) {
perror("failed to set the log size");
exit(EXIT_FAILURE);
}
-#endif
-
if (getLogSize) {
long size, readable;
@@ -737,8 +714,6 @@ int main(int argc, char **argv)
dev = dev->next;
}
-#ifdef USERDEBUG_BUILD
-
if (setPruneList) {
size_t len = strlen(setPruneList) + 32; // margin to allow rc
char *buf = (char *) malloc(len);
@@ -753,30 +728,18 @@ int main(int argc, char **argv)
}
}
-#endif
-
- if (
-#ifdef USERDEBUG_BUILD
- printStatistics || getPruneList
-#else
- printStatistics
-#endif
- ) {
+ if (printStatistics || getPruneList) {
size_t len = 8192;
char *buf;
for(int retry = 32;
(retry >= 0) && ((buf = new char [len]));
delete [] buf, --retry) {
-#ifdef USERDEBUG_BUILD
if (getPruneList) {
android_logger_get_prune_list(logger_list, buf, len);
} else {
android_logger_get_statistics(logger_list, buf, len);
}
-#else
- android_logger_get_statistics(logger_list, buf, len);
-#endif
buf[len-1] = '\0';
size_t ret = atol(buf) + 1;
if (ret < 4) {
@@ -824,11 +787,9 @@ int main(int argc, char **argv)
if (getLogSize) {
exit(0);
}
-#ifdef USERDEBUG_BUILD
if (setLogSize || setPruneList) {
exit(0);
}
-#endif
if (clearLog) {
exit(0);
}
diff --git a/logcat/tests/Android.mk b/logcat/tests/Android.mk
index 733af31..d42b3d0 100644
--- a/logcat/tests/Android.mk
+++ b/logcat/tests/Android.mk
@@ -30,10 +30,6 @@ test_c_flags := \
-Werror \
-fno-builtin
-ifneq ($(filter userdebug eng,$(TARGET_BUILD_VARIANT)),)
-test_c_flags += -DUSERDEBUG_BUILD=1
-endif
-
test_src_files := \
logcat_test.cpp \
diff --git a/logcat/tests/logcat_test.cpp b/logcat/tests/logcat_test.cpp
index 0165073..b07cc8b 100644
--- a/logcat/tests/logcat_test.cpp
+++ b/logcat/tests/logcat_test.cpp
@@ -609,7 +609,6 @@ TEST(logcat, blocking_clear) {
EXPECT_EQ(1, signals);
}
-#ifdef USERDEBUG_BUILD
static bool get_white_black(char **list) {
FILE *fp;
@@ -705,4 +704,3 @@ TEST(logcat, white_black_adjust) {
free(list);
list = NULL;
}
-#endif // USERDEBUG_BUILD