From 99296a15108f950c60c7864a374e3ef1f5909e76 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 17 Dec 2022 23:31:09 -0800 Subject: common: logging: Implement Android logcat backend. --- src/common/logging/text_formatter.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/common/logging/text_formatter.cpp') diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp index 09398ea64..709f610a3 100644 --- a/src/common/logging/text_formatter.cpp +++ b/src/common/logging/text_formatter.cpp @@ -8,6 +8,10 @@ #include #endif +#ifdef ANDROID +#include +#endif + #include "common/assert.h" #include "common/logging/filter.h" #include "common/logging/log.h" @@ -106,4 +110,35 @@ void PrintColoredMessage(const Entry& entry) { #undef ESC #endif } + +void PrintMessageToLogcat(const Entry& entry) { +#ifdef ANDROID + const auto str = FormatLogMessage(entry); + + android_LogPriority android_log_priority; + switch (entry.log_level) { + case Level::Trace: + android_log_priority = ANDROID_LOG_VERBOSE; + break; + case Level::Debug: + android_log_priority = ANDROID_LOG_DEBUG; + break; + case Level::Info: + android_log_priority = ANDROID_LOG_INFO; + break; + case Level::Warning: + android_log_priority = ANDROID_LOG_WARN; + break; + case Level::Error: + android_log_priority = ANDROID_LOG_ERROR; + break; + case Level::Critical: + android_log_priority = ANDROID_LOG_FATAL; + break; + case Level::Count: + UNREACHABLE(); + } + __android_log_print(android_log_priority, "CitraNative", "%s", str.c_str()); +#endif +} } // namespace Common::Log -- cgit v1.2.3 From 3f35b34515cd9b475845b286942c37ef4c8832d9 Mon Sep 17 00:00:00 2001 From: Narr the Reg Date: Tue, 21 Mar 2023 19:41:22 -0600 Subject: Use yuzu as category instead of citra --- src/common/logging/text_formatter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common/logging/text_formatter.cpp') diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp index 709f610a3..2c453177b 100644 --- a/src/common/logging/text_formatter.cpp +++ b/src/common/logging/text_formatter.cpp @@ -138,7 +138,7 @@ void PrintMessageToLogcat(const Entry& entry) { case Level::Count: UNREACHABLE(); } - __android_log_print(android_log_priority, "CitraNative", "%s", str.c_str()); + __android_log_print(android_log_priority, "YuzuNative", "%s", str.c_str()); #endif } } // namespace Common::Log -- cgit v1.2.3