From 7f1304ae0a78ed3d86ecab5c7b9ffabff0e7edde Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Tue, 30 Apr 2024 10:49:29 -0700 Subject: Enable liblog_stub to work with variable tags This was liblog_stub limitation not present in liblog. Bug: 285204695 Test: m libbinder_sdk Change-Id: If15321783bb7b58749a62c9091fe6b1774cd4cc9 --- libs/binder/liblog_stub/include/log/log.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libs/binder/liblog_stub/include/log/log.h b/libs/binder/liblog_stub/include/log/log.h index 91c9632c1b..dad0020ace 100644 --- a/libs/binder/liblog_stub/include/log/log.h +++ b/libs/binder/liblog_stub/include/log/log.h @@ -54,16 +54,16 @@ int __android_log_print(int prio, const char* tag, const char* fmt, ...) #define IF_ALOGW() IF_ALOG(LOG_WARN, LOG_TAG) #define IF_ALOGE() IF_ALOG(LOG_ERROR, LOG_TAG) -#define ALOG(priority, tag, fmt, ...) \ - do { \ - if (false)[[/*VERY*/ unlikely]] { /* ignore unused __VA_ARGS__ */ \ - std::fprintf(stderr, fmt __VA_OPT__(, ) __VA_ARGS__); \ - } \ - IF_ALOG(priority, tag) { \ - __android_log_print(ANDROID_##priority, tag, \ - tag ": " fmt "\n" __VA_OPT__(, ) __VA_ARGS__); \ - } \ - if constexpr (ANDROID_##priority == ANDROID_LOG_FATAL) std::abort(); \ +#define ALOG(priority, tag, fmt, ...) \ + do { \ + if (false)[[/*VERY*/ unlikely]] { /* ignore unused __VA_ARGS__ */ \ + std::fprintf(stderr, fmt __VA_OPT__(, ) __VA_ARGS__); \ + } \ + IF_ALOG(priority, tag) { \ + __android_log_print(ANDROID_##priority, tag, "%s: " fmt "\n", \ + (tag)__VA_OPT__(, ) __VA_ARGS__); \ + } \ + if constexpr (ANDROID_##priority == ANDROID_LOG_FATAL) std::abort(); \ } while (false) #define ALOGV(...) ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__) #define ALOGD(...) ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__) -- cgit v1.2.3-59-g8ed1b