diff options
author | bunnei <bunneidev@gmail.com> | 2022-12-18 08:31:09 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:05:26 +0200 |
commit | 99296a15108f950c60c7864a374e3ef1f5909e76 (patch) | |
tree | 6189575f5e74f658d3181fdd2467bf894a5bf940 /src/common/logging/text_formatter.cpp | |
parent | common: host_memory: Implement for Android. (diff) | |
download | yuzu-99296a15108f950c60c7864a374e3ef1f5909e76.tar yuzu-99296a15108f950c60c7864a374e3ef1f5909e76.tar.gz yuzu-99296a15108f950c60c7864a374e3ef1f5909e76.tar.bz2 yuzu-99296a15108f950c60c7864a374e3ef1f5909e76.tar.lz yuzu-99296a15108f950c60c7864a374e3ef1f5909e76.tar.xz yuzu-99296a15108f950c60c7864a374e3ef1f5909e76.tar.zst yuzu-99296a15108f950c60c7864a374e3ef1f5909e76.zip |
Diffstat (limited to 'src/common/logging/text_formatter.cpp')
-rw-r--r-- | src/common/logging/text_formatter.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
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 <windows.h> #endif +#ifdef ANDROID +#include <android/log.h> +#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 |