Skip to content

Commit a25744e

Browse files
authored
Reduce log verbosity (#5)
Logcat logs are verbose and repeatedly spam the same message. This PR reduces the log verbosity. * The FILE prefix is no longer used for log messages. * The warning for gator not running is only emitted once.
2 parents 7b5e385 + dd3d98a commit a25744e

4 files changed

Lines changed: 9 additions & 11 deletions

File tree

Native~/streamline_annotate.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* SPDX-License-Identifier: BSD-3-Clause
33
*
4-
* Copyright (c) 2014-2021, Arm Limited
4+
* Copyright (c) 2014-2022, Arm Limited
55
* All rights reserved.
66
*
77
* Redistribution and use in source and binary forms, with or without
@@ -501,12 +501,10 @@ static void* gator_func(void *arg)
501501
} else {
502502
gator_stop_capturing();
503503
if (print) {
504-
LOG(LOG_ERROR,
505-
"Warning : Not connected to gatord, " //
506-
"the application will run normally but Streamline will not collect annotations. " //
507-
"To collect annotations, please verify you are running gatord 5.%i or later and that SELinux " //
508-
"is disabled.\n", //
509-
gator_minimum_version);
504+
LOG(LOG_WARN,
505+
"Warning : Not connected to gatord. The application will run " //
506+
"normally but Streamline will not collect annotations.");
507+
print = false;
510508
}
511509
sleep(1);
512510
continue;
@@ -560,7 +558,7 @@ static void* gator_func(void *arg)
560558
if (!gator_send(thread, write_pos)) {
561559
LOG(LOG_ERROR,
562560
"Failed to send bytes, " //
563-
"gator_thread = (exited:%s, fd:%d, oob_length:%ld, read_pos:%d, tid:%d), " //
561+
"gator_thread = (exited:%s, fd:%d, oob_length:%zd, read_pos:%d, tid:%d), " //
564562
"write_pos = %u", //
565563
thread->exited ? "true" : "false",
566564
thread->fd,

Native~/streamline_annotate_logging.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* SPDX-License-Identifier: BSD-3-Clause
33
*
4-
* Copyright (c) 2021, Arm Limited
4+
* Copyright (c) 2021-2022, Arm Limited
55
* All rights reserved.
66
*
77
* Redistribution and use in source and binary forms, with or without
@@ -55,7 +55,7 @@ enum log_levels {
5555
#define LOG_TAG "AnnotationLog"
5656

5757
#define LOGGING(LOG_LEVEL, fmt, ...) \
58-
__android_log_print(LOG_LEVEL, LOG_TAG, "%s/%s:%d " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);
58+
__android_log_print(LOG_LEVEL, LOG_TAG, "%s:%d " fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__);
5959

6060
/* LINUX IMPLEMENTATION */
6161
#elif defined(linux) || defined(__linux) || defined(__linux__)
@@ -71,7 +71,7 @@ char *log_levels[] = { "UNKNOWN",
7171
"SILENT"};
7272
// clang-format on
7373
#define LOGGING(LOG_LEVEL, fmt, ...) \
74-
printf("%s/%s:%d [%s] " fmt " \n", __FILE__, __func__, __LINE__, log_levels[LOG_LEVEL], ##__VA_ARGS__);
74+
printf("%s:%d [%s] " fmt " \n", __func__, __LINE__, log_levels[LOG_LEVEL], ##__VA_ARGS__);
7575

7676
#endif
7777
//Use to do logging, if not needed un-define this variable
-120 Bytes
Binary file not shown.
-168 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)