diff options
| author | 2022-12-17 23:31:09 -0800 | |
|---|---|---|
| committer | 2023-06-03 00:05:26 -0700 | |
| commit | 99296a15108f950c60c7864a374e3ef1f5909e76 (patch) | |
| tree | 6189575f5e74f658d3181fdd2467bf894a5bf940 /src/common/logging/backend.cpp | |
| parent | common: host_memory: Implement for Android. (diff) | |
| download | yuzu-99296a15108f950c60c7864a374e3ef1f5909e76.tar.gz yuzu-99296a15108f950c60c7864a374e3ef1f5909e76.tar.xz yuzu-99296a15108f950c60c7864a374e3ef1f5909e76.zip | |
common: logging: Implement Android logcat backend.
Diffstat (limited to '')
| -rw-r--r-- | src/common/logging/backend.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index f96c7c222..6e8e8eb36 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp | |||
| @@ -155,6 +155,26 @@ public: | |||
| 155 | void EnableForStacktrace() override {} | 155 | void EnableForStacktrace() override {} |
| 156 | }; | 156 | }; |
| 157 | 157 | ||
| 158 | #ifdef ANDROID | ||
| 159 | /** | ||
| 160 | * Backend that writes to the Android logcat | ||
| 161 | */ | ||
| 162 | class LogcatBackend : public Backend { | ||
| 163 | public: | ||
| 164 | explicit LogcatBackend() = default; | ||
| 165 | |||
| 166 | ~LogcatBackend() override = default; | ||
| 167 | |||
| 168 | void Write(const Entry& entry) override { | ||
| 169 | PrintMessageToLogcat(entry); | ||
| 170 | } | ||
| 171 | |||
| 172 | void Flush() override {} | ||
| 173 | |||
| 174 | void EnableForStacktrace() override {} | ||
| 175 | }; | ||
| 176 | #endif | ||
| 177 | |||
| 158 | bool initialization_in_progress_suppress_logging = true; | 178 | bool initialization_in_progress_suppress_logging = true; |
| 159 | 179 | ||
| 160 | /** | 180 | /** |
| @@ -260,6 +280,9 @@ private: | |||
| 260 | lambda(static_cast<Backend&>(debugger_backend)); | 280 | lambda(static_cast<Backend&>(debugger_backend)); |
| 261 | lambda(static_cast<Backend&>(color_console_backend)); | 281 | lambda(static_cast<Backend&>(color_console_backend)); |
| 262 | lambda(static_cast<Backend&>(file_backend)); | 282 | lambda(static_cast<Backend&>(file_backend)); |
| 283 | #ifdef ANDROID | ||
| 284 | lambda(static_cast<Backend&>(lc_backend)); | ||
| 285 | #endif | ||
| 263 | } | 286 | } |
| 264 | 287 | ||
| 265 | static void Deleter(Impl* ptr) { | 288 | static void Deleter(Impl* ptr) { |
| @@ -272,6 +295,9 @@ private: | |||
| 272 | DebuggerBackend debugger_backend{}; | 295 | DebuggerBackend debugger_backend{}; |
| 273 | ColorConsoleBackend color_console_backend{}; | 296 | ColorConsoleBackend color_console_backend{}; |
| 274 | FileBackend file_backend; | 297 | FileBackend file_backend; |
| 298 | #ifdef ANDROID | ||
| 299 | LogcatBackend lc_backend{}; | ||
| 300 | #endif | ||
| 275 | 301 | ||
| 276 | MPSCQueue<Entry> message_queue{}; | 302 | MPSCQueue<Entry> message_queue{}; |
| 277 | std::chrono::steady_clock::time_point time_origin{std::chrono::steady_clock::now()}; | 303 | std::chrono::steady_clock::time_point time_origin{std::chrono::steady_clock::now()}; |