summaryrefslogtreecommitdiff
path: root/src/common/logging/text_formatter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/logging/text_formatter.cpp')
-rw-r--r--src/common/logging/text_formatter.cpp35
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..2c453177b 100644
--- a/src/common/logging/text_formatter.cpp
+++ b/src/common/logging/text_formatter.cpp
@@ -8,6 +8,10 @@
8#include <windows.h> 8#include <windows.h>
9#endif 9#endif
10 10
11#ifdef ANDROID
12#include <android/log.h>
13#endif
14
11#include "common/assert.h" 15#include "common/assert.h"
12#include "common/logging/filter.h" 16#include "common/logging/filter.h"
13#include "common/logging/log.h" 17#include "common/logging/log.h"
@@ -106,4 +110,35 @@ void PrintColoredMessage(const Entry& entry) {
106#undef ESC 110#undef ESC
107#endif 111#endif
108} 112}
113
114void PrintMessageToLogcat(const Entry& entry) {
115#ifdef ANDROID
116 const auto str = FormatLogMessage(entry);
117
118 android_LogPriority android_log_priority;
119 switch (entry.log_level) {
120 case Level::Trace:
121 android_log_priority = ANDROID_LOG_VERBOSE;
122 break;
123 case Level::Debug:
124 android_log_priority = ANDROID_LOG_DEBUG;
125 break;
126 case Level::Info:
127 android_log_priority = ANDROID_LOG_INFO;
128 break;
129 case Level::Warning:
130 android_log_priority = ANDROID_LOG_WARN;
131 break;
132 case Level::Error:
133 android_log_priority = ANDROID_LOG_ERROR;
134 break;
135 case Level::Critical:
136 android_log_priority = ANDROID_LOG_FATAL;
137 break;
138 case Level::Count:
139 UNREACHABLE();
140 }
141 __android_log_print(android_log_priority, "YuzuNative", "%s", str.c_str());
142#endif
143}
109} // namespace Common::Log 144} // namespace Common::Log