From 5939270d2c3defcb0c760c224aa1f66b0eb37819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 21 Jul 2024 12:20:23 +0200 Subject: [PATCH] Log: Split out StdioListener from ConsoleListener, making the second Win32-only. --- CMakeLists.txt | 10 +-- Common/Common.vcxproj | 12 ++-- Common/Common.vcxproj.filters | 9 +-- Common/{ => Log}/ConsoleListener.cpp | 11 ++- Common/{ => Log}/ConsoleListener.h | 17 +++-- Common/{ => Log}/LogManager.cpp | 23 +++++- Common/{ => Log}/LogManager.h | 10 +++ Common/Log/StdioListener.cpp | 81 ++++++++++++++++++++++ Common/Log/StdioListener.h | 36 ++++++++++ Common/LogReporting.cpp | 2 +- Core/Config.cpp | 2 +- Core/Debugger/WebSocket/LogBroadcaster.cpp | 2 +- Core/HLE/sceKernel.cpp | 2 +- Core/HLE/sceKernelThread.cpp | 2 +- Core/System.cpp | 1 - Qt/mainwindow.cpp | 2 + Qt/mainwindow.h | 5 +- UI/DevScreens.cpp | 2 +- UI/GPUDriverTestScreen.h | 2 +- UI/NativeApp.cpp | 2 +- UI/Theme.cpp | 2 +- UWP/App.cpp | 2 +- UWP/CommonUWP/CommonUWP.vcxproj | 10 +-- UWP/CommonUWP/CommonUWP.vcxproj.filters | 10 +-- UWP/PPSSPP_UWPMain.cpp | 2 +- Windows/Debugger/Debugger_MemoryDlg.cpp | 2 +- Windows/MainWindow.cpp | 4 +- Windows/MainWindowMenu.cpp | 4 +- Windows/main.cpp | 6 +- android/jni/Android.mk | 2 +- android/jni/app-android.h | 2 +- headless/Headless.cpp | 4 +- libretro/Makefile.common | 5 +- libretro/libretro.cpp | 6 +- 34 files changed, 230 insertions(+), 64 deletions(-) rename Common/{ => Log}/ConsoleListener.cpp (99%) rename Common/{ => Log}/ConsoleListener.h (93%) rename Common/{ => Log}/LogManager.cpp (95%) rename Common/{ => Log}/LogManager.h (96%) create mode 100644 Common/Log/StdioListener.cpp create mode 100644 Common/Log/StdioListener.h diff --git a/CMakeLists.txt b/CMakeLists.txt index f62b8f3560..7b5d5bf027 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -863,8 +863,6 @@ add_library(Common STATIC Common/Common.h Common/CommonFuncs.h Common/CommonTypes.h - Common/ConsoleListener.cpp - Common/ConsoleListener.h Common/DbgNew.h Common/FakeEmitter.h Common/FakeCPUDetect.cpp @@ -872,8 +870,12 @@ add_library(Common STATIC Common/ExceptionHandlerSetup.h Common/Log.h Common/Log.cpp - Common/LogManager.cpp - Common/LogManager.h + Common/Log/ConsoleListener.cpp + Common/Log/ConsoleListener.h + Common/Log/StdioListener.cpp + Common/Log/StdioListener.h + Common/Log/LogManager.cpp + Common/Log/LogManager.h Common/LogReporting.cpp Common/LogReporting.h Common/MemArenaAndroid.cpp diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj index 3c6f42532f..0b65c4e83c 100644 --- a/Common/Common.vcxproj +++ b/Common/Common.vcxproj @@ -548,7 +548,8 @@ - + + @@ -557,7 +558,7 @@ - + @@ -979,7 +980,8 @@ - + + true @@ -1005,7 +1007,7 @@ - + @@ -1083,4 +1085,4 @@ - \ No newline at end of file + diff --git a/Common/Common.vcxproj.filters b/Common/Common.vcxproj.filters index f9e7e742df..d4d9c2fa17 100644 --- a/Common/Common.vcxproj.filters +++ b/Common/Common.vcxproj.filters @@ -8,7 +8,7 @@ - + @@ -563,11 +563,12 @@ - + + - + @@ -1207,4 +1208,4 @@ Render\Text - \ No newline at end of file + diff --git a/Common/ConsoleListener.cpp b/Common/Log/ConsoleListener.cpp similarity index 99% rename from Common/ConsoleListener.cpp rename to Common/Log/ConsoleListener.cpp index 35fa1e5e05..9ecf054be3 100644 --- a/Common/ConsoleListener.cpp +++ b/Common/Log/ConsoleListener.cpp @@ -15,6 +15,10 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ +#include "ppsspp_config.h" + +#if PPSSPP_PLATFORM(WINDOWS) + #include #include // min #include @@ -22,7 +26,7 @@ #include #ifdef _WIN32 #include -#include "CommonWindows.h" +#include "Common/CommonWindows.h" #include #else #include @@ -31,11 +35,10 @@ #include #endif -#include "ppsspp_config.h" #include "Common/Thread/ThreadUtil.h" #include "Common/Data/Encoding/Utf8.h" #include "Common/CommonTypes.h" -#include "Common/ConsoleListener.h" +#include "Common/Log/ConsoleListener.h" #include "Common/StringUtils.h" #if defined(USING_WIN_UI) @@ -659,3 +662,5 @@ void ConsoleListener::ClearScreen(bool Cursor) if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen); #endif } + +#endif // PPSSPP_PLATFORM(WINDOWS) diff --git a/Common/ConsoleListener.h b/Common/Log/ConsoleListener.h similarity index 93% rename from Common/ConsoleListener.h rename to Common/Log/ConsoleListener.h index a84bb25765..1831ea9a2a 100644 --- a/Common/ConsoleListener.h +++ b/Common/Log/ConsoleListener.h @@ -17,13 +17,16 @@ #pragma once +// Windows-only. + +#include "ppsspp_config.h" + +#if PPSSPP_PLATFORM(WINDOWS) + #include -#include "LogManager.h" - -#ifdef _WIN32 -#include "CommonWindows.h" -#endif +#include "Common/Log/LogManager.h" +#include "Common/CommonWindows.h" class ConsoleListener : public LogListener { public: @@ -38,9 +41,7 @@ public: void LetterSpace(int Width, int Height); void BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst); void PixelSpace(int Left, int Top, int Width, int Height, bool); -#if defined(USING_WIN_UI) COORD GetCoordinates(int BytesRead, int BufferWidth); -#endif void Log(const LogMessage &message) override; void ClearScreen(bool Cursor = true); @@ -73,3 +74,5 @@ private: bool bHidden; bool bUseColor; }; + +#endif diff --git a/Common/LogManager.cpp b/Common/Log/LogManager.cpp similarity index 95% rename from Common/LogManager.cpp rename to Common/Log/LogManager.cpp index 1039ac55b9..1b29f9ccfc 100644 --- a/Common/LogManager.cpp +++ b/Common/Log/LogManager.cpp @@ -28,8 +28,13 @@ #include "Common/Data/Encoding/Utf8.h" -#include "Common/LogManager.h" -#include "Common/ConsoleListener.h" +#include "Common/Log/LogManager.h" + +#if PPSSPP_PLATFORM(WINDOWS) +#include "Common/Log/ConsoleListener.h" +#endif + +#include "Common/Log/StdioListener.h" #include "Common/TimeUtil.h" #include "Common/File/FileUtil.h" #include "Common/StringUtils.h" @@ -137,10 +142,12 @@ LogManager::LogManager(bool *enabledSetting) { #else #if !defined(MOBILE_DEVICE) || defined(_DEBUG) fileLog_ = new FileLogListener(""); +#if PPSSPP_PLATFORM(WINDOWS) consoleLog_ = new ConsoleListener(); -#ifdef _WIN32 if (IsDebuggerPresent()) debuggerLog_ = new OutputDebugStringLogListener(); +#else + stdioLog_ = new StdioListener(); #endif #endif ringLog_ = new RingbufferLogListener(); @@ -148,7 +155,11 @@ LogManager::LogManager(bool *enabledSetting) { #if !defined(MOBILE_DEVICE) || defined(_DEBUG) AddListener(fileLog_); +#if PPSSPP_PLATFORM(WINDOWS) AddListener(consoleLog_); +#else + AddListener(stdioLog_); +#endif #if defined(_MSC_VER) && (defined(USING_WIN_UI) || PPSSPP_PLATFORM(UWP)) if (IsDebuggerPresent() && debuggerLog_ && LOG_MSC_OUTPUTDEBUG) AddListener(debuggerLog_); @@ -161,7 +172,10 @@ LogManager::~LogManager() { for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; ++i) { #if !defined(MOBILE_DEVICE) || defined(_DEBUG) RemoveListener(fileLog_); +#if PPSSPP_PLATFORM(WINDOWS) RemoveListener(consoleLog_); +#endif + RemoveListener(stdioLog_); #if defined(_MSC_VER) && defined(USING_WIN_UI) RemoveListener(debuggerLog_); #endif @@ -174,7 +188,10 @@ LogManager::~LogManager() { if (fileLog_) delete fileLog_; #if !defined(MOBILE_DEVICE) || defined(_DEBUG) +#if PPSSPP_PLATFORM(WINDOWS) delete consoleLog_; +#endif + delete stdioLog_; delete debuggerLog_; #endif delete ringLog_; diff --git a/Common/LogManager.h b/Common/Log/LogManager.h similarity index 96% rename from Common/LogManager.h rename to Common/Log/LogManager.h index 23e41939a6..1bceb3433e 100644 --- a/Common/LogManager.h +++ b/Common/Log/LogManager.h @@ -104,6 +104,7 @@ struct LogChannel { }; class ConsoleListener; +class StdioListener; class LogManager { private: @@ -116,7 +117,10 @@ private: LogChannel log_[(size_t)Log::NUMBER_OF_LOGS]; FileLogListener *fileLog_ = nullptr; +#if PPSSPP_PLATFORM(WINDOWS) ConsoleListener *consoleLog_ = nullptr; +#endif + StdioListener *stdioLog_ = nullptr; OutputDebugStringLogListener *debuggerLog_ = nullptr; RingbufferLogListener *ringLog_ = nullptr; static LogManager *logManager_; // Singleton. Ugh. @@ -157,9 +161,15 @@ public: return log_[(size_t)type].level; } +#if PPSSPP_PLATFORM(WINDOWS) ConsoleListener *GetConsoleListener() const { return consoleLog_; } +#endif + + StdioListener *GetStdioListener() const { + return stdioLog_; + } OutputDebugStringLogListener *GetDebuggerListener() const { return debuggerLog_; diff --git a/Common/Log/StdioListener.cpp b/Common/Log/StdioListener.cpp new file mode 100644 index 0000000000..ce0efd5203 --- /dev/null +++ b/Common/Log/StdioListener.cpp @@ -0,0 +1,81 @@ +// Copyright (C) 2014- PPSSPP Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#include +#include // min +#include +#include // System: To be able to add strings with "+" +#include +#include +#ifndef _MSC_VER +#include +#endif + +#include "ppsspp_config.h" +#include "Common/Thread/ThreadUtil.h" +#include "Common/Data/Encoding/Utf8.h" +#include "Common/CommonTypes.h" +#include "Common/Log/StdioListener.h" +#include "Common/StringUtils.h" + +StdioListener::StdioListener() { +#if PPSSPP_PLATFORM(IOS) || PPSSPP_PLATFORM(UWP) || PPSSPP_PLATFORM(SWITCH) + bUseColor = false; +#elif defined(_MSC_VER) + bUseColor = false; +#elif defined(__APPLE__) + // Xcode builtin terminal used for debugging does not support colours. + // Fortunately it can be detected with a TERM env variable. + bUseColor = isatty(fileno(stdout)) && getenv("TERM") != NULL; +#else + bUseColor = isatty(fileno(stdout)); +#endif +} + +void StdioListener::Log(const LogMessage &msg) { + char Text[2048]; + snprintf(Text, sizeof(Text), "%s %s %s", msg.timestamp, msg.header, msg.msg.c_str()); + Text[sizeof(Text) - 2] = '\n'; + Text[sizeof(Text) - 1] = '\0'; + + char ColorAttr[16] = ""; + char ResetAttr[16] = ""; + + if (bUseColor) { + strcpy(ResetAttr, "\033[0m"); + switch (msg.level) { + case LogLevel::LNOTICE: // light green + strcpy(ColorAttr, "\033[92m"); + break; + case LogLevel::LERROR: // light red + strcpy(ColorAttr, "\033[91m"); + break; + case LogLevel::LWARNING: // light yellow + strcpy(ColorAttr, "\033[93m"); + break; + case LogLevel::LINFO: // cyan + strcpy(ColorAttr, "\033[96m"); + break; + case LogLevel::LDEBUG: // gray + strcpy(ColorAttr, "\033[90m"); + break; + default: + break; + } + } + fprintf(stderr, "%s%s%s", ColorAttr, Text, ResetAttr); +} diff --git a/Common/Log/StdioListener.h b/Common/Log/StdioListener.h new file mode 100644 index 0000000000..2b46599b34 --- /dev/null +++ b/Common/Log/StdioListener.h @@ -0,0 +1,36 @@ +#pragma once + +// Copyright (C) 2003 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#include + +#include "Common/Log/LogManager.h" + +#ifdef _WIN32 +#include "Common/CommonWindows.h" +#endif + +class StdioListener : public LogListener { +public: + StdioListener(); + void Log(const LogMessage &message) override; +private: + bool bUseColor = true; +}; diff --git a/Common/LogReporting.cpp b/Common/LogReporting.cpp index 4b1a092238..7c6ac3b440 100644 --- a/Common/LogReporting.cpp +++ b/Common/LogReporting.cpp @@ -89,4 +89,4 @@ void ReportMessageFormatted(const char *message, const char *formatted) { messageCallback(message, formatted); } -} +} // namespace diff --git a/Core/Config.cpp b/Core/Config.cpp index 7fdd75511e..abdf63f3a3 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -39,7 +39,7 @@ #include "Common/CPUDetect.h" #include "Common/File/FileUtil.h" #include "Common/File/VFS/VFS.h" -#include "Common/LogManager.h" +#include "Common/Log/LogManager.h" #include "Common/OSVersion.h" #include "Common/System/Display.h" #include "Common/System/System.h" diff --git a/Core/Debugger/WebSocket/LogBroadcaster.cpp b/Core/Debugger/WebSocket/LogBroadcaster.cpp index b3d4359c89..61a0a9afa1 100644 --- a/Core/Debugger/WebSocket/LogBroadcaster.cpp +++ b/Core/Debugger/WebSocket/LogBroadcaster.cpp @@ -17,7 +17,7 @@ #include #include -#include "Common/LogManager.h" +#include "Common/Log/LogManager.h" #include "Core/Debugger/WebSocket/LogBroadcaster.h" #include "Core/Debugger/WebSocket/WebSocketUtils.h" diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index fd7ab5c1a6..4f90bc94ba 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -16,7 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Common/Serialize/SerializeFuncs.h" -#include "Common/LogManager.h" +#include "Common/Log/LogManager.h" #include "Common/System/OSD.h" #include "Core/Core.h" diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index d2a22881a2..91066511c1 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -22,7 +22,7 @@ #include #include "Common/CommonTypes.h" -#include "Common/LogManager.h" +#include "Common/Log/LogManager.h" #include "Common/StringUtils.h" #include "Common/Serialize/Serializer.h" #include "Common/Serialize/SerializeFuncs.h" diff --git a/Core/System.cpp b/Core/System.cpp index 46205f0238..cd14a7ccc2 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -67,7 +67,6 @@ #include "Core/PSPLoaders.h" #include "Core/ELF/ParamSFO.h" #include "Core/SaveState.h" -#include "Common/LogManager.h" #include "Common/ExceptionHandlerSetup.h" #include "Core/HLE/sceAudiocodec.h" #include "GPU/GPUState.h" diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 5897edcb62..e982aff696 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -350,7 +350,9 @@ void MainWindow::dumpNextAct() void MainWindow::consoleAct() { +#if PPSSPP_PLATFORM(WINDOWS) LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden()); +#endif } void MainWindow::raiseTopMost() diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index b9da7ee905..edda066b1c 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -9,9 +9,12 @@ #include #include +#include "ppsspp_config.h" #include "Common/System/System.h" #include "Common/System/NativeApp.h" -#include "ConsoleListener.h" +#if PPSSPP_PLATFORM(WINDOWS) +#include "Common/Log/ConsoleListener.h" +#endif #include "Core/Core.h" #include "Core/Config.h" #include "Core/System.h" diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 851b1504ab..d929026165 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -46,7 +46,7 @@ #include "Common/Data/Text/Parsers.h" #include "Common/Profiler/Profiler.h" -#include "Common/LogManager.h" +#include "Common/Log/LogManager.h" #include "Common/CPUDetect.h" #include "Common/StringUtils.h" diff --git a/UI/GPUDriverTestScreen.h b/UI/GPUDriverTestScreen.h index 5c8b67cfa4..6f27f855be 100644 --- a/UI/GPUDriverTestScreen.h +++ b/UI/GPUDriverTestScreen.h @@ -5,7 +5,7 @@ #include "Common/UI/View.h" #include "Common/UI/ViewGroup.h" -#include "Common/LogManager.h" +#include "Common/Log.h" #include "UI/MiscScreens.h" #include "Common/GPU/thin3d.h" diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index ba3c0dfacf..0c379ee373 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -78,7 +78,7 @@ #include "Common/File/FileUtil.h" #include "Common/TimeUtil.h" #include "Common/StringUtils.h" -#include "Common/LogManager.h" +#include "Common/Log/LogManager.h" #include "Common/MemArena.h" #include "Common/GraphicsContext.h" #include "Common/OSVersion.h" diff --git a/UI/Theme.cpp b/UI/Theme.cpp index b5f1b492d0..f3459d7172 100644 --- a/UI/Theme.cpp +++ b/UI/Theme.cpp @@ -25,7 +25,7 @@ #include "Common/File/VFS/VFS.h" #include "Common/Data/Format/IniFile.h" #include "Common/File/DirListing.h" -#include "Common/LogManager.h" +#include "Common/Log/LogManager.h" #include "Core/Config.h" diff --git a/UWP/App.cpp b/UWP/App.cpp index 6383d59516..937021eff8 100644 --- a/UWP/App.cpp +++ b/UWP/App.cpp @@ -15,7 +15,7 @@ #include "Common/Input/InputState.h" #include "Common/System/NativeApp.h" #include "Common/System/System.h" -#include "Common/LogManager.h" +#include "Common/Log/LogManager.h" #include "Core/System.h" #include "Core/Config.h" #include "Core/Core.h" diff --git a/UWP/CommonUWP/CommonUWP.vcxproj b/UWP/CommonUWP/CommonUWP.vcxproj index b7bf692fbf..195b61c8b4 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj +++ b/UWP/CommonUWP/CommonUWP.vcxproj @@ -188,7 +188,8 @@ - + + @@ -197,7 +198,7 @@ - + @@ -342,7 +343,8 @@ - + + @@ -350,7 +352,7 @@ - + diff --git a/UWP/CommonUWP/CommonUWP.vcxproj.filters b/UWP/CommonUWP/CommonUWP.vcxproj.filters index 183f8f48f0..f38724008a 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj.filters +++ b/UWP/CommonUWP/CommonUWP.vcxproj.filters @@ -111,12 +111,13 @@ - + + - + @@ -508,13 +509,14 @@ - + + - + diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index 11ce531a98..9dab125f5a 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -18,7 +18,7 @@ #include "Common/DirectXHelper.h" #include "Common/File/FileUtil.h" #include "Common/Log.h" -#include "Common/LogManager.h" +#include "Common/Log/LogManager.h" #include "Common/TimeUtil.h" #include "Common/StringUtils.h" #include "Common/System/Display.h" diff --git a/Windows/Debugger/Debugger_MemoryDlg.cpp b/Windows/Debugger/Debugger_MemoryDlg.cpp index 670713e1c3..7c320212ab 100644 --- a/Windows/Debugger/Debugger_MemoryDlg.cpp +++ b/Windows/Debugger/Debugger_MemoryDlg.cpp @@ -13,7 +13,7 @@ #include "Debugger_MemoryDlg.h" #include "CtrlMemView.h" #include "DebuggerShared.h" -#include "LogManager.h" +#include "Common/Log.h" #include "winnt.h" #include #include diff --git a/Windows/MainWindow.cpp b/Windows/MainWindow.cpp index f72abc7ed1..8921e9c985 100644 --- a/Windows/MainWindow.cpp +++ b/Windows/MainWindow.cpp @@ -72,8 +72,8 @@ #include "Windows/resource.h" #include "Windows/MainWindow.h" -#include "Common/LogManager.h" -#include "Common/ConsoleListener.h" +#include "Common/Log/LogManager.h" +#include "Common/Log/ConsoleListener.h" #include "Windows/W32Util/DialogManager.h" #include "Windows/W32Util/ShellUtil.h" #include "Windows/W32Util/Misc.h" diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index 106aa478df..c3237c56da 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -19,8 +19,8 @@ #include "Common/System/Request.h" #include "Common/File/FileUtil.h" #include "Common/Log.h" -#include "Common/LogManager.h" -#include "Common/ConsoleListener.h" +#include "Common/Log/LogManager.h" +#include "Common/Log/ConsoleListener.h" #include "Common/OSVersion.h" #include "Common/GPU/Vulkan/VulkanLoader.h" #include "Common/StringUtils.h" diff --git a/Windows/main.cpp b/Windows/main.cpp index b7bc133151..e70aebfe9e 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -55,8 +55,8 @@ #include "Windows/WindowsAudio.h" #include "ext/disarm.h" -#include "Common/LogManager.h" -#include "Common/ConsoleListener.h" +#include "Common/Log/LogManager.h" +#include "Common/Log/ConsoleListener.h" #include "Common/StringUtils.h" #include "Commctrl.h" @@ -1010,7 +1010,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin // - By default in Debug, the console should be shown by default. // - The -l switch is expected to show the log console, REGARDLESS of config settings. // - It should be possible to log to a file without showing the console. - LogManager::GetInstance()->GetConsoleListener()->Init(showLog, 150, 120, "PPSSPP Debug Console"); + LogManager::GetInstance()->GetConsoleListener()->Init(showLog, 150, 120); if (debugLogLevel) { LogManager::GetInstance()->SetAllLogLevels(LogLevel::LDEBUG); diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 150161553f..8ad6ea1aac 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -326,7 +326,7 @@ EXEC_AND_LIB_FILES := \ $(SRC)/Common/ExceptionHandlerSetup.cpp \ $(SRC)/Common/FakeCPUDetect.cpp \ $(SRC)/Common/Log.cpp \ - $(SRC)/Common/LogManager.cpp \ + $(SRC)/Common/Log/LogManager.cpp \ $(SRC)/Common/LogReporting.cpp \ $(SRC)/Common/MemArenaAndroid.cpp \ $(SRC)/Common/MemArenaDarwin.cpp \ diff --git a/android/jni/app-android.h b/android/jni/app-android.h index d2d7957dcb..15328af1af 100644 --- a/android/jni/app-android.h +++ b/android/jni/app-android.h @@ -5,7 +5,7 @@ #include #include -#include "Common/LogManager.h" +#include "Common/Log/LogManager.h" #include "Common/File/DirListing.h" #include "Common/File/Path.h" #include "Common/File/AndroidStorage.h" diff --git a/headless/Headless.cpp b/headless/Headless.cpp index 4487a445cd..061f4aa9b5 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -40,8 +40,8 @@ #include "Core/HLE/sceUtility.h" #include "Core/SaveState.h" #include "GPU/Common/FramebufferManagerCommon.h" -#include "Log.h" -#include "LogManager.h" +#include "Common/Log.h" +#include "Common/Log/LogManager.h" #include "Compare.h" #include "HeadlessHost.h" diff --git a/libretro/Makefile.common b/libretro/Makefile.common index a2189ae9f2..74e06c3c38 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -433,11 +433,12 @@ SOURCES_CXX += \ $(COMMONDIR)/ArmCPUDetect.cpp \ $(COMMONDIR)/CPUDetect.cpp \ $(COMMONDIR)/Buffer.cpp \ - $(COMMONDIR)/ConsoleListener.cpp \ + $(COMMONDIR)/Log/ConsoleListener.cpp \ + $(COMMONDIR)/Log/StdioListener.cpp \ $(COMMONDIR)/ExceptionHandlerSetup.cpp \ $(COMMONDIR)/FakeCPUDetect.cpp \ $(COMMONDIR)/Log.cpp \ - $(COMMONDIR)/LogManager.cpp \ + $(COMMONDIR)/Log/LogManager.cpp \ $(COMMONDIR)/OSVersion.cpp \ $(COMMONDIR)/MemoryUtil.cpp \ $(COMMONDIR)/MipsCPUDetect.cpp \ diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 586ebd9036..f3bcdfa624 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -9,14 +9,14 @@ #include "Common/CPUDetect.h" #include "Common/Log.h" -#include "Common/LogManager.h" +#include "Common/Log/LogManager.h" #include "Common/System/Display.h" #include "Common/System/NativeApp.h" #include "Common/System/System.h" #include "Common/TimeUtil.h" #include "Common/File/FileUtil.h" #include "Common/Serialize/Serializer.h" -#include "Common/ConsoleListener.h" +#include "Common/Log/StdioListener.h" #include "Common/Input/InputState.h" #include "Common/Thread/ThreadUtil.h" #include "Common/Thread/ThreadManager.h" @@ -1202,7 +1202,7 @@ void retro_init(void) LogManager::Init(&g_Config.bEnableLogging); printfLogger = new PrintfLogger(log); LogManager* logman = LogManager::GetInstance(); - logman->RemoveListener(logman->GetConsoleListener()); + logman->RemoveListener(logman->GetStdioListener()); logman->RemoveListener(logman->GetDebuggerListener()); logman->ChangeFileLog(nullptr); logman->AddListener(printfLogger);