summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Charles Lombardo2023-11-01 00:45:13 -0400
committerGravatar Charles Lombardo2023-11-01 14:41:19 -0400
commit92418e909f7bb3d2c199b9392304f4bd1dea65bc (patch)
treed26f391569b105fc5c88305109696bbf515cf6f0 /src
parentMerge pull request #11934 from zhaobot/tx-update-20231101020822 (diff)
downloadyuzu-92418e909f7bb3d2c199b9392304f4bd1dea65bc.tar.gz
yuzu-92418e909f7bb3d2c199b9392304f4bd1dea65bc.tar.xz
yuzu-92418e909f7bb3d2c199b9392304f4bd1dea65bc.zip
android: Use yuzu logging system
Now anything that's logged in the frontend will be printed into the log file
Diffstat (limited to 'src')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt4
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.kt34
-rw-r--r--src/android/app/src/main/jni/CMakeLists.txt1
-rw-r--r--src/android/app/src/main/jni/native_log.cpp31
4 files changed, 39 insertions, 31 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt
index 07f1b4842..ed8fe6c3f 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt
@@ -462,12 +462,12 @@ object NativeLibrary {
462 } 462 }
463 463
464 fun setEmulationActivity(emulationActivity: EmulationActivity?) { 464 fun setEmulationActivity(emulationActivity: EmulationActivity?) {
465 Log.verbose("[NativeLibrary] Registering EmulationActivity.") 465 Log.debug("[NativeLibrary] Registering EmulationActivity.")
466 sEmulationActivity = WeakReference(emulationActivity) 466 sEmulationActivity = WeakReference(emulationActivity)
467 } 467 }
468 468
469 fun clearEmulationActivity() { 469 fun clearEmulationActivity() {
470 Log.verbose("[NativeLibrary] Unregistering EmulationActivity.") 470 Log.debug("[NativeLibrary] Unregistering EmulationActivity.")
471 sEmulationActivity.clear() 471 sEmulationActivity.clear()
472 } 472 }
473 473
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.kt
index a193e82a4..1d3c7dce3 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.kt
@@ -3,38 +3,14 @@
3 3
4package org.yuzu.yuzu_emu.utils 4package org.yuzu.yuzu_emu.utils
5 5
6import android.util.Log
7import org.yuzu.yuzu_emu.BuildConfig
8
9/**
10 * Contains methods that call through to [android.util.Log], but
11 * with the same TAG automatically provided. Also no-ops VERBOSE and DEBUG log
12 * levels in release builds.
13 */
14object Log { 6object Log {
15 private const val TAG = "Yuzu Frontend" 7 external fun debug(message: String)
16
17 fun verbose(message: String) {
18 if (BuildConfig.DEBUG) {
19 Log.v(TAG, message)
20 }
21 }
22 8
23 fun debug(message: String) { 9 external fun warning(message: String)
24 if (BuildConfig.DEBUG) {
25 Log.d(TAG, message)
26 }
27 }
28 10
29 fun info(message: String) { 11 external fun info(message: String)
30 Log.i(TAG, message)
31 }
32 12
33 fun warning(message: String) { 13 external fun error(message: String)
34 Log.w(TAG, message)
35 }
36 14
37 fun error(message: String) { 15 external fun critical(message: String)
38 Log.e(TAG, message)
39 }
40} 16}
diff --git a/src/android/app/src/main/jni/CMakeLists.txt b/src/android/app/src/main/jni/CMakeLists.txt
index 1c36661f5..88a570f68 100644
--- a/src/android/app/src/main/jni/CMakeLists.txt
+++ b/src/android/app/src/main/jni/CMakeLists.txt
@@ -18,6 +18,7 @@ add_library(yuzu-android SHARED
18 native_config.cpp 18 native_config.cpp
19 uisettings.cpp 19 uisettings.cpp
20 game_metadata.cpp 20 game_metadata.cpp
21 native_log.cpp
21) 22)
22 23
23set_property(TARGET yuzu-android PROPERTY IMPORTED_LOCATION ${FFmpeg_LIBRARY_DIR}) 24set_property(TARGET yuzu-android PROPERTY IMPORTED_LOCATION ${FFmpeg_LIBRARY_DIR})
diff --git a/src/android/app/src/main/jni/native_log.cpp b/src/android/app/src/main/jni/native_log.cpp
new file mode 100644
index 000000000..33d691dc8
--- /dev/null
+++ b/src/android/app/src/main/jni/native_log.cpp
@@ -0,0 +1,31 @@
1// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include <common/logging/log.h>
5#include <jni.h>
6
7#include "android_common/android_common.h"
8
9extern "C" {
10
11void Java_org_yuzu_yuzu_1emu_utils_Log_debug(JNIEnv* env, jobject obj, jstring jmessage) {
12 LOG_DEBUG(Frontend, "{}", GetJString(env, jmessage));
13}
14
15void Java_org_yuzu_yuzu_1emu_utils_Log_warning(JNIEnv* env, jobject obj, jstring jmessage) {
16 LOG_WARNING(Frontend, "{}", GetJString(env, jmessage));
17}
18
19void Java_org_yuzu_yuzu_1emu_utils_Log_info(JNIEnv* env, jobject obj, jstring jmessage) {
20 LOG_INFO(Frontend, "{}", GetJString(env, jmessage));
21}
22
23void Java_org_yuzu_yuzu_1emu_utils_Log_error(JNIEnv* env, jobject obj, jstring jmessage) {
24 LOG_ERROR(Frontend, "{}", GetJString(env, jmessage));
25}
26
27void Java_org_yuzu_yuzu_1emu_utils_Log_critical(JNIEnv* env, jobject obj, jstring jmessage) {
28 LOG_CRITICAL(Frontend, "{}", GetJString(env, jmessage));
29}
30
31} // extern "C"