Add a checkbox to enable file logging from the UI, in developer settings.

Fixes issue #20372.

The file is written to PSP/SYSTEM/DUMP/log.txt by default, but you can
override from the command line if needed.
This commit is contained in:
Henrik Rydgård committed 2025-05-25 18:54:30 +02:00
1 parent 7936f2a8dd
commit 65229026bb
54 files changed
+87 -13

No files matched your search

+2 -2
View File
@@ -194,7 +194,7 @@ LogManager::~LogManager() {
#endif
}
void LogManager::ChangeFileLog(const Path &filename) {
void LogManager::SetFileLogPath(const Path &filename) {
if (fp_ && filename == logFilename_) {
// All good
return;
@@ -235,7 +235,7 @@ void LogManager::LoadConfig(const Section *section, bool debugDefaults) {
void LogManager::SetOutputsEnabled(LogOutput outputs) {
outputs_ = outputs;
if (outputs & LogOutput::File) {
ChangeFileLog(logFilename_);
SetFileLogPath(logFilename_);
}
}
+9 -1
View File
@@ -95,6 +95,13 @@ public:
temp &= ~output;
SetOutputsEnabled(temp);
}
void EnableOutput(LogOutput output, bool enabled) {
if (enabled) {
EnableOutput(output);
} else {
DisableOutput(output);
}
}
static u32 GetMaxLevel() { return (u32)MAX_LOGLEVEL; }
static int GetNumChannels() { return (int)Log::NUMBER_OF_LOGS; }
@@ -142,7 +149,8 @@ public:
externalUserData_ = userdata;
}
void ChangeFileLog(const Path &filename);
void SetFileLogPath(const Path &filename);
const Path &GetLogFilePath() const { return logFilename_; }
void SaveConfig(Section *section);
void LoadConfig(const Section *section, bool debugDefaults);
+2 -1
View File
@@ -217,7 +217,8 @@ static float DefaultUISaturation() {
static const ConfigSetting generalSettings[] = {
ConfigSetting("FirstRun", &g_Config.bFirstRun, true, CfgFlag::DEFAULT),
ConfigSetting("RunCount", &g_Config.iRunCount, 0, CfgFlag::DEFAULT),
ConfigSetting("Enable Logging", &g_Config.bEnableLogging, true, CfgFlag::DEFAULT),
ConfigSetting("Enable Logging", &g_Config.bEnableLogging, true, CfgFlag::PER_GAME),
ConfigSetting("FileLogging", &g_Config.bEnableFileLogging, false, CfgFlag::PER_GAME),
ConfigSetting("AutoRun", &g_Config.bAutoRun, true, CfgFlag::DEFAULT),
ConfigSetting("Browse", &g_Config.bBrowse, false, CfgFlag::DEFAULT),
ConfigSetting("IgnoreBadMemAccess", &g_Config.bIgnoreBadMemAccess, true, CfgFlag::DEFAULT),
+2
View File
@@ -85,6 +85,8 @@ public:
bool bDumpAudio;
bool bSaveLoadResetsAVdumping;
bool bEnableLogging;
bool bEnableFileLogging;
int iLogOutputTypes; // enum class LogOutput
int iDumpFileTypes; // DumpFileType bitflag enum
bool bFullscreenOnDoubleclick;
+13
View File
@@ -39,6 +39,7 @@
#include "Common/File/FileUtil.h"
#include "Common/File/DirListing.h"
#include "Common/File/AndroidContentURI.h"
#include "Common/Log/LogManager.h"
#include "Common/TimeUtil.h"
#include "Common/Thread/ThreadUtil.h"
#include "Common/GraphicsContext.h"
@@ -93,6 +94,7 @@ static volatile CPUThreadState cpuThreadState = CPU_THREAD_NOT_RUNNING;
static GPUBackend gpuBackend;
static std::string gpuBackendDevice;
static bool g_fileLoggingWasEnabled;
static BootState g_bootState = BootState::Off;
@@ -373,6 +375,15 @@ static bool CPU_Init(FileLoader *fileLoader, IdentifiedFileType type, std::strin
return false;
}
// If it was forced on the command line. We don't want to override that.
g_fileLoggingWasEnabled = g_logManager.GetOutputsEnabled() & LogOutput::File;
g_logManager.EnableOutput(LogOutput::File, g_Config.bEnableFileLogging || g_fileLoggingWasEnabled);
if ((g_logManager.GetOutputsEnabled() & LogOutput::File) && !g_logManager.GetLogFilePath().empty()) {
auto dev = GetI18NCategory(I18NCat::DEVELOPER);
g_OSD.Show(OSDType::MESSAGE_INFO, ApplySafeSubstitutions("%1: %2", dev->T("Log to file"), g_logManager.GetLogFilePath().ToVisualString()));
}
InitVFPU();
LoadSymbolsIfSupported();
@@ -482,6 +493,8 @@ void CPU_Shutdown(bool success) {
g_symbolMap = nullptr;
g_lua.Shutdown();
g_logManager.EnableOutput(LogOutput::File, g_fileLoggingWasEnabled);
}
// Used for UMD switching only.
+6 -6
View File
@@ -43,12 +43,12 @@ dependencies = [
[[package]]
name = "anstyle-wincon"
version = "3.0.7"
version = "3.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e"
checksum = "6680de5231bd6ee4c6191b8a1325daa282b415391ec9d3a37bd34f2060dc73fa"
dependencies = [
"anstyle",
"once_cell",
"once_cell_polyfill",
"windows-sys",
]
@@ -118,10 +118,10 @@ dependencies = [
]
[[package]]
name = "once_cell"
version = "1.21.3"
name = "once_cell_polyfill"
version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
[[package]]
name = "proc-macro2"
+1
View File
@@ -157,6 +157,7 @@ void DeveloperToolsScreen::CreateGeneralTab(UI::LinearLayout *list) {
list->Add(new ItemHeader(sy->T("General")));
list->Add(new CheckBox(&g_Config.bEnableLogging, dev->T("Enable Logging")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLoggingChanged);
list->Add(new CheckBox(&g_Config.bEnableFileLogging, dev->T("Log to file")))->SetEnabledPtr(&g_Config.bEnableLogging);
list->Add(new Choice(dev->T("Logging Channels")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLogConfig);
list->Add(new CheckBox(&g_Config.bLogFrameDrops, dev->T("Log Dropped Frame Statistics")));
if (GetGPUBackend() == GPUBackend::VULKAN) {
+6 -2
View File
@@ -664,11 +664,15 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
if (fileToLog) {
g_logManager.EnableOutput(LogOutput::File);
g_logManager.ChangeFileLog(Path(fileToLog));
g_logManager.SetFileLogPath(Path(fileToLog));
} else {
// Set a default file logging path, in case the user enables it with the checkbox later.
g_logManager.SetFileLogPath(GetSysDirectory(DIRECTORY_DUMP) / "log.txt");
}
if (forceLogLevel)
if (forceLogLevel) {
g_logManager.SetAllLogLevels(logLevel);
}
PostLoadConfig();
+1 -1
View File
@@ -75,7 +75,7 @@ PPSSPP_UWPMain::PPSSPP_UWPMain(App ^app, const std::shared_ptr<DX::DeviceResourc
g_logManager.SetAllLogLevels(LogLevel::LDEBUG);
if (g_Config.bEnableLogging) {
g_logManager.ChangeFileLog(Path(GetLogFile()));
g_logManager.SetFileLogPath(Path(GetLogFile()));
}
#endif
+1
View File
@@ -336,6 +336,7 @@ Jit Compare = Jit compare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = ‎سجل التفاصيل للفريمات المتدنية
Log Level = ‎مستوي السجل
Log to file = Log to file
Log View = ‎أظهر السجل
Logging Channels = ‎قنوات التسجيل
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit compare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Log level
Log to file = Log to file
Log View = Log view
Logging Channels = Logging channels
Medium = Medium
+1
View File
@@ -330,6 +330,7 @@ Jit Compare = JIT compare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Log level
Log to file = Log to file
Log View = Log view
Logging Channels = Logging channels
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit compare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Log level
Log to file = Log to file
Log View = Log view
Logging Channels = Logging channels
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Comparació Jit
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Registra estadístiques de caigudes de quadres
Log Level = Nivell del registre
Log to file = Log to file
Log View = Veure el registre
Logging Channels = Canals del registre
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Porovnání JIT
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Úroveň záznamu
Log to file = Log to file
Log View = Zobrazení záznamu
Logging Channels = Kanály záznamu
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit sammenlign
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log Droppede Frames Statistik
Log Level = Logniveau
Log to file = Log to file
Log View = Log visning
Logging Channels = Logkanaler
Medium = Medium
+1
View File
@@ -326,6 +326,7 @@ Jit Compare = JIT-Vergleich
JIT debug tools = JIT-Fehlerbehebungs-Werkzeuge
Log Dropped Frame Statistics = Statistik für fehlende Einzelbilder protokollieren
Log Level = Protokollierungsstufe
Log to file = Log to file
Log View = Protokollansicht
Logging Channels = Protkollkanäle
Multi-threaded rendering = Multi-threaded rendering
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit compare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Log level
Log to file = Log to file
Log View = Log view
Logging Channels = Logging channels
Medium = Medium
+1
View File
@@ -354,6 +354,7 @@ Jit Compare = JIT compare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Log level
Log to file = Log to file
Log View = Log view
Logging Channels = Logging channels
Medium = Medium
+1
View File
@@ -331,6 +331,7 @@ Jit Compare = Comparación JIT
JIT debug tools = Herramientas de depuración JIT
Log Dropped Frame Statistics = Estadísticas de fotogramas perdidos en el registro
Log Level = Nivel de registro
Log to file = Log to file
Log View = Ver el registro
Logging Channels = Canales de registro
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Comparar JIT
JIT debug tools = Herramientas de depuración de JIT
Log Dropped Frame Statistics = Registrar estadísticas de frames caídos
Log Level = Nivel de registro
Log to file = Log to file
Log View = Ver el registro
Logging Channels = Canales de registro
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit compare
JIT debug tools = ابزار دیباگ کردن JIT
Log Dropped Frame Statistics = ورود آمار کادر کاهش یافته است
Log Level = سطح خطا
Log to file = Log to file
Log View = مشاهده خطا
Logging Channels = رکورد خطا چنل‌ها
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit compare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Log level
Log to file = Log to file
Log View = Log view
Logging Channels = Logging channels
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Comparaison JIT
JIT debug tools = Outils de débogage JIT
Log Dropped Frame Statistics = Enregistrer les statistiques sur les pertes d'images
Log Level = Niveau du journal
Log to file = Log to file
Log View = Voir le journal
Logging Channels = Filtres du journal de débogage
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Comparación JIT
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Nivel de rexistro
Log to file = Log to file
Log View = Ver o rexistro
Logging Channels = Canles de rexistro
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Σύγκριση Jit
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Καταγραφή Στατιστικών για Dropped Frames
Log Level = Επίπεδο καταγραφής
Log to file = Log to file
Log View = Εμφάνιση καταγραφέα
Logging Channels = Καταγραφή καναλιών
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit compare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Log level
Log to file = Log to file
Log View = Log view
Logging Channels = Logging channels
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit compare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Log level
Log to file = Log to file
Log View = Log view
Logging Channels = Logging channels
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = JIT uspoređivanje
JIT debug tools = JIT debug alati
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Log level
Log to file = Log to file
Log View = Log pregled
Logging Channels = Logging kanali
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = JIT összehasonlítás
JIT debug tools = JIT hibakereső eszközök
Log Dropped Frame Statistics = Eldobott képkockák statisztikáinak naplózása
Log Level = Naplózási szint
Log to file = Log to file
Log View = Nápló nézet
Logging Channels = Naplózási csatornák
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Bandingkan Jit
JIT debug tools = Alat awakutu JIT
Log Dropped Frame Statistics = Log statistik laju bingkai yang jatuh
Log Level = Tingkatan pencatat
Log to file = Log to file
Log View = Tampilan pencatat
Logging Channels = Kanal pencatatan
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Confronto Jit
JIT debug tools = Strumenti di debug JIT
Log Dropped Frame Statistics = Statistiche dei Frame Persi
Log Level = Livello del Log
Log to file = Log to file
Log View = Visualizza Log
Logging Channels = Registra Canali
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = JIT 比較
JIT debug tools = JITデバッグツール
Log Dropped Frame Statistics = ドロップしたフレームの統計を記録する
Log Level = ログレベル
Log to file = Log to file
Log View = ログビュー
Logging Channels = ログチャネル
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit mbandhingake
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Tingkat Log
Log to file = Log to file
Log View = Tampilan Log
Logging Channels = Saluran ngangkut barang
Medium = Medium
+1
View File
@@ -330,6 +330,7 @@ Jit Compare = JIT 비교
JIT debug tools = JIT 디버그 도구
Log Dropped Frame Statistics = 삭제된 프레임 통계 기록
Log Level = 로그 레벨
Log to file = Log to file
Log View = 로그 보기
Logging Channels = 로깅 채널
Medium = 중간
+1
View File
@@ -344,6 +344,7 @@ Jit Compare = JIT compare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Log level
Log to file = Log to file
Log View = Log view
Logging Channels = Logging channels
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit compare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = ເກັບຄ່າສະຖິຕິເຟຣມເຣດຕົກ
Log Level = ເກັບຄ່າລະດັບ
Log to file = Log to file
Log View = ເກັບຄ່າມຸມມອງ
Logging Channels = ຊ່ອງທາງເກັບຄ່າຂໍ້ມູນ
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit compare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Log level
Log to file = Log to file
Log View = Log view
Logging Channels = Rašymo į statusą kanalai
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit compare
JIT debug tools = Alat pepijat JIT
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Log level
Log to file = Log to file
Log View = Log view
Logging Channels = Log Channel
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit vergelijken
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Overgeslagen framestatistieken vastleggen
Log Level = Logniveau
Log to file = Log to file
Log View = Logboekoverzicht
Logging Channels = Logboekkanalen
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit compare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Log level
Log to file = Log to file
Log View = Log view
Logging Channels = Logging channels
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Porównywanie JIT
JIT debug tools = Narzędzia debugowania JIT
Log Dropped Frame Statistics = Loguj statystyki pominiętych klatek
Log Level = Poziom dziennika zdarzeń
Log to file = Log to file
Log View = Pokaż dziennik zdarzeń
Logging Channels = Kanały dziennika zdarzeń debugera
Medium = Medium
+1
View File
@@ -354,6 +354,7 @@ Jit Compare = Comparar JIT
JIT debug tools = Ferramentas de debug do JIT
Log Dropped Frame Statistics = Registrar as estatísticas da queda dos frames
Log Level = Nível do registro
Log to file = Log to file
Log View = Visualização do registro
Logging Channels = Canais do registro
Medium = Médio
+1
View File
@@ -352,6 +352,7 @@ Jit Compare = Comparar JIT
JIT debug tools = Ferramentas de depuração do JIT
Log Dropped Frame Statistics = Guardar no Log as estátisticas da queda de frames
Log Level = Nível de Log
Log to file = Log to file
Log View = Visualização do Log
Logging Channels = Canais de Logging
Medium = Medium
+1
View File
@@ -329,6 +329,7 @@ Jit Compare = Jit compare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Log level
Log to file = Log to file
Log View = Log view
Logging Channels = Logging channels
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Сравнение с JIT
JIT debug tools = Инструменты отладки JIT
Log Dropped Frame Statistics = Логировать статистику пропущенных кадров
Log Level = Уровень отладки
Log to file = Log to file
Log View = Отображение логов
Logging Channels = Параметры логирования
Medium = Средний
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Jit-jämförare
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Log dropped frame statistics
Log Level = Loggnivå
Log to file = Log to file
Log View = Loggvy
Logging Channels = Loggkanaler
Medium = Medium
+1
View File
@@ -329,6 +329,7 @@ Jit Compare = Ipagkumpara ang JIT
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Isama sa log ang istatistika ng mga na-drop na frame
Log Level = Level ng Log
Log to file = Log to file
Log View = Log view
Logging Channels = Mga Logging channels
Medium = Medium
+1
View File
@@ -338,6 +338,7 @@ Jit Compare = เปรียบเทียบระบบ JIT
JIT debug tools = เครื่องมือตรวจสอบระบบ JIT
Log Dropped Frame Statistics = เก็บสถิติค่าเฟรมเรทตก
Log Level = เก็บค่าระดับ
Log to file = Log to file
Log View = เก็บค่ามุมมอง
Logging Channels = ช่องทางเก็บค่าข้อมูล
Max allowed trace size = ขนาดการติดตามสูงสุดที่อนุญาต
+1
View File
@@ -330,6 +330,7 @@ Jit Compare = Jit karşılaştırma
JIT debug tools = JIT hata ayıklama araçları
Log Dropped Frame Statistics = Düşen kare istatistiklerini günlükle
Log Level = Günlük seviyesi
Log to file = Log to file
Log View = Günlük görünümü
Logging Channels = Günlük kanalları
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = Порівняння з Jit
JIT debug tools = Інструменти налагодження JIT
Log Dropped Frame Statistics = Лог статистики пропущених кадрів
Log Level = Лог рівня
Log to file = Log to file
Log View = Лог виду
Logging Channels = Параметри логування
Medium = Середня
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = So sánh Jit
JIT debug tools = JIT debug tools
Log Dropped Frame Statistics = Khung nhật ký thống kê
Log Level = Cấp nhật ký
Log to file = Log to file
Log View = Xem nhật ký
Logging Channels = Kênh nhật ký
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = JIT比较
JIT debug tools = JIT调试工具
Log Dropped Frame Statistics = 记录丢帧统计信息
Log Level = 日志等级
Log to file = Log to file
Log View = 日志视图
Logging Channels = 日志记录分类
Medium = Medium
+1
View File
@@ -328,6 +328,7 @@ Jit Compare = JIT 比較
JIT debug tools = JIT 偵錯工具
Log Dropped Frame Statistics = 記錄捨棄影格統計資料
Log Level = 記錄層級
Log to file = Log to file
Log View = 記錄檢視
Logging Channels = 記錄通道
Medium = Medium