Log: Split out StdioListener from ConsoleListener, making the second Win32-only.

This commit is contained in:
Henrik Rydgård 2024-07-21 12:20:23 +02:00
parent 5edd02ef0a
commit 5939270d2c
34 changed files with 230 additions and 64 deletions

View File

@ -863,8 +863,6 @@ add_library(Common STATIC
Common/Common.h Common/Common.h
Common/CommonFuncs.h Common/CommonFuncs.h
Common/CommonTypes.h Common/CommonTypes.h
Common/ConsoleListener.cpp
Common/ConsoleListener.h
Common/DbgNew.h Common/DbgNew.h
Common/FakeEmitter.h Common/FakeEmitter.h
Common/FakeCPUDetect.cpp Common/FakeCPUDetect.cpp
@ -872,8 +870,12 @@ add_library(Common STATIC
Common/ExceptionHandlerSetup.h Common/ExceptionHandlerSetup.h
Common/Log.h Common/Log.h
Common/Log.cpp Common/Log.cpp
Common/LogManager.cpp Common/Log/ConsoleListener.cpp
Common/LogManager.h 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.cpp
Common/LogReporting.h Common/LogReporting.h
Common/MemArenaAndroid.cpp Common/MemArenaAndroid.cpp

View File

@ -548,7 +548,8 @@
<ClInclude Include="CommonFuncs.h" /> <ClInclude Include="CommonFuncs.h" />
<ClInclude Include="CommonTypes.h" /> <ClInclude Include="CommonTypes.h" />
<ClInclude Include="CommonWindows.h" /> <ClInclude Include="CommonWindows.h" />
<ClInclude Include="ConsoleListener.h" /> <ClInclude Include="Log\ConsoleListener.h" />
<ClInclude Include="Log\StdioListener.h" />
<ClInclude Include="CPUDetect.h" /> <ClInclude Include="CPUDetect.h" />
<ClInclude Include="Crypto\md5.h" /> <ClInclude Include="Crypto\md5.h" />
<ClInclude Include="Crypto\sha1.h" /> <ClInclude Include="Crypto\sha1.h" />
@ -557,7 +558,7 @@
<ClInclude Include="ExceptionHandlerSetup.h" /> <ClInclude Include="ExceptionHandlerSetup.h" />
<ClInclude Include="GraphicsContext.h" /> <ClInclude Include="GraphicsContext.h" />
<ClInclude Include="Log.h" /> <ClInclude Include="Log.h" />
<ClInclude Include="LogManager.h" /> <ClInclude Include="Log\LogManager.h" />
<ClInclude Include="MachineContext.h" /> <ClInclude Include="MachineContext.h" />
<ClInclude Include="MemArena.h" /> <ClInclude Include="MemArena.h" />
<ClInclude Include="MemoryUtil.h" /> <ClInclude Include="MemoryUtil.h" />
@ -979,7 +980,8 @@
<ClCompile Include="LoongArchCPUDetect.cpp" /> <ClCompile Include="LoongArchCPUDetect.cpp" />
<ClCompile Include="Serialize\Serializer.cpp" /> <ClCompile Include="Serialize\Serializer.cpp" />
<ClCompile Include="Data\Convert\ColorConv.cpp" /> <ClCompile Include="Data\Convert\ColorConv.cpp" />
<ClCompile Include="ConsoleListener.cpp" /> <ClCompile Include="Log\ConsoleListener.cpp" />
<ClCompile Include="Log\StdioListener.cpp" />
<ClCompile Include="CPUDetect.cpp" /> <ClCompile Include="CPUDetect.cpp" />
<ClCompile Include="MipsCPUDetect.cpp"> <ClCompile Include="MipsCPUDetect.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -1005,7 +1007,7 @@
<ClCompile Include="Crypto\sha1.cpp" /> <ClCompile Include="Crypto\sha1.cpp" />
<ClCompile Include="Crypto\sha256.cpp" /> <ClCompile Include="Crypto\sha256.cpp" />
<ClCompile Include="ExceptionHandlerSetup.cpp" /> <ClCompile Include="ExceptionHandlerSetup.cpp" />
<ClCompile Include="LogManager.cpp" /> <ClCompile Include="Log\LogManager.cpp" />
<ClCompile Include="MemArenaAndroid.cpp" /> <ClCompile Include="MemArenaAndroid.cpp" />
<ClCompile Include="MemArenaPosix.cpp" /> <ClCompile Include="MemArenaPosix.cpp" />
<ClCompile Include="MemArenaWin32.cpp" /> <ClCompile Include="MemArenaWin32.cpp" />
@ -1083,4 +1085,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -8,7 +8,7 @@
<ClInclude Include="ConsoleListener.h" /> <ClInclude Include="ConsoleListener.h" />
<ClInclude Include="CPUDetect.h" /> <ClInclude Include="CPUDetect.h" />
<ClInclude Include="Log.h" /> <ClInclude Include="Log.h" />
<ClInclude Include="LogManager.h" /> <ClInclude Include="Log\LogManager.h" />
<ClInclude Include="MemArena.h" /> <ClInclude Include="MemArena.h" />
<ClInclude Include="MemoryUtil.h" /> <ClInclude Include="MemoryUtil.h" />
<ClInclude Include="StringUtils.h" /> <ClInclude Include="StringUtils.h" />
@ -563,11 +563,12 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="ABI.cpp" /> <ClCompile Include="ABI.cpp" />
<ClCompile Include="ConsoleListener.cpp" /> <ClCompile Include="Log\ConsoleListener.cpp" />
<ClCompile Include="Log\StdioListener.cpp" />
<ClCompile Include="CPUDetect.cpp" /> <ClCompile Include="CPUDetect.cpp" />
<ClCompile Include="FakeCPUDetect.cpp" /> <ClCompile Include="FakeCPUDetect.cpp" />
<ClCompile Include="MipsCPUDetect.cpp" /> <ClCompile Include="MipsCPUDetect.cpp" />
<ClCompile Include="LogManager.cpp" /> <ClCompile Include="Log\LogManager.cpp" />
<ClCompile Include="MemoryUtil.cpp" /> <ClCompile Include="MemoryUtil.cpp" />
<ClCompile Include="StringUtils.cpp" /> <ClCompile Include="StringUtils.cpp" />
<ClCompile Include="Thunk.cpp" /> <ClCompile Include="Thunk.cpp" />
@ -1207,4 +1208,4 @@
<Filter>Render\Text</Filter> <Filter>Render\Text</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -15,6 +15,10 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "ppsspp_config.h"
#if PPSSPP_PLATFORM(WINDOWS)
#include <atomic> #include <atomic>
#include <algorithm> // min #include <algorithm> // min
#include <cstring> #include <cstring>
@ -22,7 +26,7 @@
#include <math.h> #include <math.h>
#ifdef _WIN32 #ifdef _WIN32
#include <process.h> #include <process.h>
#include "CommonWindows.h" #include "Common/CommonWindows.h"
#include <array> #include <array>
#else #else
#include <stdarg.h> #include <stdarg.h>
@ -31,11 +35,10 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "ppsspp_config.h"
#include "Common/Thread/ThreadUtil.h" #include "Common/Thread/ThreadUtil.h"
#include "Common/Data/Encoding/Utf8.h" #include "Common/Data/Encoding/Utf8.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/ConsoleListener.h" #include "Common/Log/ConsoleListener.h"
#include "Common/StringUtils.h" #include "Common/StringUtils.h"
#if defined(USING_WIN_UI) #if defined(USING_WIN_UI)
@ -659,3 +662,5 @@ void ConsoleListener::ClearScreen(bool Cursor)
if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen); if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen);
#endif #endif
} }
#endif // PPSSPP_PLATFORM(WINDOWS)

View File

@ -17,13 +17,16 @@
#pragma once #pragma once
// Windows-only.
#include "ppsspp_config.h"
#if PPSSPP_PLATFORM(WINDOWS)
#include <atomic> #include <atomic>
#include "LogManager.h" #include "Common/Log/LogManager.h"
#include "Common/CommonWindows.h"
#ifdef _WIN32
#include "CommonWindows.h"
#endif
class ConsoleListener : public LogListener { class ConsoleListener : public LogListener {
public: public:
@ -38,9 +41,7 @@ public:
void LetterSpace(int Width, int Height); void LetterSpace(int Width, int Height);
void BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst); void BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst);
void PixelSpace(int Left, int Top, int Width, int Height, bool); void PixelSpace(int Left, int Top, int Width, int Height, bool);
#if defined(USING_WIN_UI)
COORD GetCoordinates(int BytesRead, int BufferWidth); COORD GetCoordinates(int BytesRead, int BufferWidth);
#endif
void Log(const LogMessage &message) override; void Log(const LogMessage &message) override;
void ClearScreen(bool Cursor = true); void ClearScreen(bool Cursor = true);
@ -73,3 +74,5 @@ private:
bool bHidden; bool bHidden;
bool bUseColor; bool bUseColor;
}; };
#endif

View File

@ -28,8 +28,13 @@
#include "Common/Data/Encoding/Utf8.h" #include "Common/Data/Encoding/Utf8.h"
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Common/ConsoleListener.h"
#if PPSSPP_PLATFORM(WINDOWS)
#include "Common/Log/ConsoleListener.h"
#endif
#include "Common/Log/StdioListener.h"
#include "Common/TimeUtil.h" #include "Common/TimeUtil.h"
#include "Common/File/FileUtil.h" #include "Common/File/FileUtil.h"
#include "Common/StringUtils.h" #include "Common/StringUtils.h"
@ -137,10 +142,12 @@ LogManager::LogManager(bool *enabledSetting) {
#else #else
#if !defined(MOBILE_DEVICE) || defined(_DEBUG) #if !defined(MOBILE_DEVICE) || defined(_DEBUG)
fileLog_ = new FileLogListener(""); fileLog_ = new FileLogListener("");
#if PPSSPP_PLATFORM(WINDOWS)
consoleLog_ = new ConsoleListener(); consoleLog_ = new ConsoleListener();
#ifdef _WIN32
if (IsDebuggerPresent()) if (IsDebuggerPresent())
debuggerLog_ = new OutputDebugStringLogListener(); debuggerLog_ = new OutputDebugStringLogListener();
#else
stdioLog_ = new StdioListener();
#endif #endif
#endif #endif
ringLog_ = new RingbufferLogListener(); ringLog_ = new RingbufferLogListener();
@ -148,7 +155,11 @@ LogManager::LogManager(bool *enabledSetting) {
#if !defined(MOBILE_DEVICE) || defined(_DEBUG) #if !defined(MOBILE_DEVICE) || defined(_DEBUG)
AddListener(fileLog_); AddListener(fileLog_);
#if PPSSPP_PLATFORM(WINDOWS)
AddListener(consoleLog_); AddListener(consoleLog_);
#else
AddListener(stdioLog_);
#endif
#if defined(_MSC_VER) && (defined(USING_WIN_UI) || PPSSPP_PLATFORM(UWP)) #if defined(_MSC_VER) && (defined(USING_WIN_UI) || PPSSPP_PLATFORM(UWP))
if (IsDebuggerPresent() && debuggerLog_ && LOG_MSC_OUTPUTDEBUG) if (IsDebuggerPresent() && debuggerLog_ && LOG_MSC_OUTPUTDEBUG)
AddListener(debuggerLog_); AddListener(debuggerLog_);
@ -161,7 +172,10 @@ LogManager::~LogManager() {
for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; ++i) { for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; ++i) {
#if !defined(MOBILE_DEVICE) || defined(_DEBUG) #if !defined(MOBILE_DEVICE) || defined(_DEBUG)
RemoveListener(fileLog_); RemoveListener(fileLog_);
#if PPSSPP_PLATFORM(WINDOWS)
RemoveListener(consoleLog_); RemoveListener(consoleLog_);
#endif
RemoveListener(stdioLog_);
#if defined(_MSC_VER) && defined(USING_WIN_UI) #if defined(_MSC_VER) && defined(USING_WIN_UI)
RemoveListener(debuggerLog_); RemoveListener(debuggerLog_);
#endif #endif
@ -174,7 +188,10 @@ LogManager::~LogManager() {
if (fileLog_) if (fileLog_)
delete fileLog_; delete fileLog_;
#if !defined(MOBILE_DEVICE) || defined(_DEBUG) #if !defined(MOBILE_DEVICE) || defined(_DEBUG)
#if PPSSPP_PLATFORM(WINDOWS)
delete consoleLog_; delete consoleLog_;
#endif
delete stdioLog_;
delete debuggerLog_; delete debuggerLog_;
#endif #endif
delete ringLog_; delete ringLog_;

View File

@ -104,6 +104,7 @@ struct LogChannel {
}; };
class ConsoleListener; class ConsoleListener;
class StdioListener;
class LogManager { class LogManager {
private: private:
@ -116,7 +117,10 @@ private:
LogChannel log_[(size_t)Log::NUMBER_OF_LOGS]; LogChannel log_[(size_t)Log::NUMBER_OF_LOGS];
FileLogListener *fileLog_ = nullptr; FileLogListener *fileLog_ = nullptr;
#if PPSSPP_PLATFORM(WINDOWS)
ConsoleListener *consoleLog_ = nullptr; ConsoleListener *consoleLog_ = nullptr;
#endif
StdioListener *stdioLog_ = nullptr;
OutputDebugStringLogListener *debuggerLog_ = nullptr; OutputDebugStringLogListener *debuggerLog_ = nullptr;
RingbufferLogListener *ringLog_ = nullptr; RingbufferLogListener *ringLog_ = nullptr;
static LogManager *logManager_; // Singleton. Ugh. static LogManager *logManager_; // Singleton. Ugh.
@ -157,9 +161,15 @@ public:
return log_[(size_t)type].level; return log_[(size_t)type].level;
} }
#if PPSSPP_PLATFORM(WINDOWS)
ConsoleListener *GetConsoleListener() const { ConsoleListener *GetConsoleListener() const {
return consoleLog_; return consoleLog_;
} }
#endif
StdioListener *GetStdioListener() const {
return stdioLog_;
}
OutputDebugStringLogListener *GetDebuggerListener() const { OutputDebugStringLogListener *GetDebuggerListener() const {
return debuggerLog_; return debuggerLog_;

View File

@ -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 <atomic>
#include <algorithm> // min
#include <cstring>
#include <string> // System: To be able to add strings with "+"
#include <math.h>
#include <stdarg.h>
#ifndef _MSC_VER
#include <unistd.h>
#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);
}

View File

@ -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 <atomic>
#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;
};

View File

@ -89,4 +89,4 @@ void ReportMessageFormatted(const char *message, const char *formatted) {
messageCallback(message, formatted); messageCallback(message, formatted);
} }
} } // namespace

View File

@ -39,7 +39,7 @@
#include "Common/CPUDetect.h" #include "Common/CPUDetect.h"
#include "Common/File/FileUtil.h" #include "Common/File/FileUtil.h"
#include "Common/File/VFS/VFS.h" #include "Common/File/VFS/VFS.h"
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Common/OSVersion.h" #include "Common/OSVersion.h"
#include "Common/System/Display.h" #include "Common/System/Display.h"
#include "Common/System/System.h" #include "Common/System/System.h"

View File

@ -17,7 +17,7 @@
#include <algorithm> #include <algorithm>
#include <mutex> #include <mutex>
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Core/Debugger/WebSocket/LogBroadcaster.h" #include "Core/Debugger/WebSocket/LogBroadcaster.h"
#include "Core/Debugger/WebSocket/WebSocketUtils.h" #include "Core/Debugger/WebSocket/WebSocketUtils.h"

View File

@ -16,7 +16,7 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "Common/Serialize/SerializeFuncs.h" #include "Common/Serialize/SerializeFuncs.h"
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Common/System/OSD.h" #include "Common/System/OSD.h"
#include "Core/Core.h" #include "Core/Core.h"

View File

@ -22,7 +22,7 @@
#include <set> #include <set>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Common/StringUtils.h" #include "Common/StringUtils.h"
#include "Common/Serialize/Serializer.h" #include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeFuncs.h" #include "Common/Serialize/SerializeFuncs.h"

View File

@ -67,7 +67,6 @@
#include "Core/PSPLoaders.h" #include "Core/PSPLoaders.h"
#include "Core/ELF/ParamSFO.h" #include "Core/ELF/ParamSFO.h"
#include "Core/SaveState.h" #include "Core/SaveState.h"
#include "Common/LogManager.h"
#include "Common/ExceptionHandlerSetup.h" #include "Common/ExceptionHandlerSetup.h"
#include "Core/HLE/sceAudiocodec.h" #include "Core/HLE/sceAudiocodec.h"
#include "GPU/GPUState.h" #include "GPU/GPUState.h"

View File

@ -350,7 +350,9 @@ void MainWindow::dumpNextAct()
void MainWindow::consoleAct() void MainWindow::consoleAct()
{ {
#if PPSSPP_PLATFORM(WINDOWS)
LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden()); LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden());
#endif
} }
void MainWindow::raiseTopMost() void MainWindow::raiseTopMost()

View File

@ -9,9 +9,12 @@
#include <QMainWindow> #include <QMainWindow>
#include <QActionGroup> #include <QActionGroup>
#include "ppsspp_config.h"
#include "Common/System/System.h" #include "Common/System/System.h"
#include "Common/System/NativeApp.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/Core.h"
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/System.h" #include "Core/System.h"

View File

@ -46,7 +46,7 @@
#include "Common/Data/Text/Parsers.h" #include "Common/Data/Text/Parsers.h"
#include "Common/Profiler/Profiler.h" #include "Common/Profiler/Profiler.h"
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Common/CPUDetect.h" #include "Common/CPUDetect.h"
#include "Common/StringUtils.h" #include "Common/StringUtils.h"

View File

@ -5,7 +5,7 @@
#include "Common/UI/View.h" #include "Common/UI/View.h"
#include "Common/UI/ViewGroup.h" #include "Common/UI/ViewGroup.h"
#include "Common/LogManager.h" #include "Common/Log.h"
#include "UI/MiscScreens.h" #include "UI/MiscScreens.h"
#include "Common/GPU/thin3d.h" #include "Common/GPU/thin3d.h"

View File

@ -78,7 +78,7 @@
#include "Common/File/FileUtil.h" #include "Common/File/FileUtil.h"
#include "Common/TimeUtil.h" #include "Common/TimeUtil.h"
#include "Common/StringUtils.h" #include "Common/StringUtils.h"
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Common/MemArena.h" #include "Common/MemArena.h"
#include "Common/GraphicsContext.h" #include "Common/GraphicsContext.h"
#include "Common/OSVersion.h" #include "Common/OSVersion.h"

View File

@ -25,7 +25,7 @@
#include "Common/File/VFS/VFS.h" #include "Common/File/VFS/VFS.h"
#include "Common/Data/Format/IniFile.h" #include "Common/Data/Format/IniFile.h"
#include "Common/File/DirListing.h" #include "Common/File/DirListing.h"
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Core/Config.h" #include "Core/Config.h"

View File

@ -15,7 +15,7 @@
#include "Common/Input/InputState.h" #include "Common/Input/InputState.h"
#include "Common/System/NativeApp.h" #include "Common/System/NativeApp.h"
#include "Common/System/System.h" #include "Common/System/System.h"
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Core/System.h" #include "Core/System.h"
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/Core.h" #include "Core/Core.h"

View File

@ -188,7 +188,8 @@
<ClInclude Include="..\..\Common\CommonFuncs.h" /> <ClInclude Include="..\..\Common\CommonFuncs.h" />
<ClInclude Include="..\..\Common\CommonTypes.h" /> <ClInclude Include="..\..\Common\CommonTypes.h" />
<ClInclude Include="..\..\Common\CommonWindows.h" /> <ClInclude Include="..\..\Common\CommonWindows.h" />
<ClInclude Include="..\..\Common\ConsoleListener.h" /> <ClInclude Include="..\..\Common\Log\ConsoleListener.h" />
<ClInclude Include="..\..\Common\Log\StdioListener.h" />
<ClInclude Include="..\..\Common\CPUDetect.h" /> <ClInclude Include="..\..\Common\CPUDetect.h" />
<ClInclude Include="..\..\Common\Crypto\md5.h" /> <ClInclude Include="..\..\Common\Crypto\md5.h" />
<ClInclude Include="..\..\Common\Crypto\sha1.h" /> <ClInclude Include="..\..\Common\Crypto\sha1.h" />
@ -197,7 +198,7 @@
<ClInclude Include="..\..\Common\ExceptionHandlerSetup.h" /> <ClInclude Include="..\..\Common\ExceptionHandlerSetup.h" />
<ClInclude Include="..\..\Common\GraphicsContext.h" /> <ClInclude Include="..\..\Common\GraphicsContext.h" />
<ClInclude Include="..\..\Common\Log.h" /> <ClInclude Include="..\..\Common\Log.h" />
<ClInclude Include="..\..\Common\LogManager.h" /> <ClInclude Include="..\..\Common\Log\LogManager.h" />
<ClInclude Include="..\..\Common\LogReporting.h" /> <ClInclude Include="..\..\Common\LogReporting.h" />
<ClInclude Include="..\..\Common\MemArena.h" /> <ClInclude Include="..\..\Common\MemArena.h" />
<ClInclude Include="..\..\Common\MemoryUtil.h" /> <ClInclude Include="..\..\Common\MemoryUtil.h" />
@ -342,7 +343,8 @@
<ClCompile Include="..\..\Common\Render\Text\draw_text_win.cpp" /> <ClCompile Include="..\..\Common\Render\Text\draw_text_win.cpp" />
<ClCompile Include="..\..\Common\Serialize\Serializer.cpp" /> <ClCompile Include="..\..\Common\Serialize\Serializer.cpp" />
<ClCompile Include="..\..\Common\Data\Convert\ColorConv.cpp" /> <ClCompile Include="..\..\Common\Data\Convert\ColorConv.cpp" />
<ClCompile Include="..\..\Common\ConsoleListener.cpp" /> <ClCompile Include="..\..\Common\Log\ConsoleListener.cpp" />
<ClCompile Include="..\..\Common\Log\StdioListener.cpp" />
<ClCompile Include="..\..\Common\CPUDetect.cpp" /> <ClCompile Include="..\..\Common\CPUDetect.cpp" />
<ClCompile Include="..\..\Common\FakeCPUDetect.cpp" /> <ClCompile Include="..\..\Common\FakeCPUDetect.cpp" />
<ClCompile Include="..\..\Common\Crypto\md5.cpp" /> <ClCompile Include="..\..\Common\Crypto\md5.cpp" />
@ -350,7 +352,7 @@
<ClCompile Include="..\..\Common\Crypto\sha256.cpp" /> <ClCompile Include="..\..\Common\Crypto\sha256.cpp" />
<ClCompile Include="..\..\Common\ExceptionHandlerSetup.cpp" /> <ClCompile Include="..\..\Common\ExceptionHandlerSetup.cpp" />
<ClCompile Include="..\..\Common\Log.cpp" /> <ClCompile Include="..\..\Common\Log.cpp" />
<ClCompile Include="..\..\Common\LogManager.cpp" /> <ClCompile Include="..\..\Common\Log\LogManager.cpp" />
<ClCompile Include="..\..\Common\LogReporting.cpp" /> <ClCompile Include="..\..\Common\LogReporting.cpp" />
<ClCompile Include="..\..\Common\MemArenaAndroid.cpp" /> <ClCompile Include="..\..\Common\MemArenaAndroid.cpp" />
<ClCompile Include="..\..\Common\MemArenaDarwin.cpp" /> <ClCompile Include="..\..\Common\MemArenaDarwin.cpp" />

View File

@ -111,12 +111,13 @@
<ClCompile Include="..\..\Common\ArmEmitter.cpp" /> <ClCompile Include="..\..\Common\ArmEmitter.cpp" />
<ClCompile Include="..\..\Common\Serialize\Serializer.cpp" /> <ClCompile Include="..\..\Common\Serialize\Serializer.cpp" />
<ClCompile Include="..\..\Common\Data\Convert\ColorConv.cpp" /> <ClCompile Include="..\..\Common\Data\Convert\ColorConv.cpp" />
<ClCompile Include="..\..\Common\ConsoleListener.cpp" /> <ClCompile Include="..\..\Common\Log\StdioListener.cpp" />
<ClCompile Include="..\..\Common\Log\ConsoleListener.cpp" />
<ClCompile Include="..\..\Common\CPUDetect.cpp" /> <ClCompile Include="..\..\Common\CPUDetect.cpp" />
<ClCompile Include="..\..\Common\FakeCPUDetect.cpp" /> <ClCompile Include="..\..\Common\FakeCPUDetect.cpp" />
<ClCompile Include="..\..\Common\ExceptionHandlerSetup.cpp" /> <ClCompile Include="..\..\Common\ExceptionHandlerSetup.cpp" />
<ClCompile Include="..\..\Common\Log.cpp" /> <ClCompile Include="..\..\Common\Log.cpp" />
<ClCompile Include="..\..\Common\LogManager.cpp" /> <ClCompile Include="..\..\Common\Log\LogManager.cpp" />
<ClCompile Include="..\..\Common\LogReporting.cpp" /> <ClCompile Include="..\..\Common\LogReporting.cpp" />
<ClCompile Include="..\..\Common\MemArenaAndroid.cpp" /> <ClCompile Include="..\..\Common\MemArenaAndroid.cpp" />
<ClCompile Include="..\..\Common\MemArenaDarwin.cpp" /> <ClCompile Include="..\..\Common\MemArenaDarwin.cpp" />
@ -508,13 +509,14 @@
<ClInclude Include="..\..\Common\CommonFuncs.h" /> <ClInclude Include="..\..\Common\CommonFuncs.h" />
<ClInclude Include="..\..\Common\CommonTypes.h" /> <ClInclude Include="..\..\Common\CommonTypes.h" />
<ClInclude Include="..\..\Common\CommonWindows.h" /> <ClInclude Include="..\..\Common\CommonWindows.h" />
<ClInclude Include="..\..\Common\ConsoleListener.h" /> <ClInclude Include="..\..\Common\Log\ConsoleListener.h" />
<ClInclude Include="..\..\Common\Log\StdioListener.h" />
<ClInclude Include="..\..\Common\CPUDetect.h" /> <ClInclude Include="..\..\Common\CPUDetect.h" />
<ClInclude Include="..\..\Common\DbgNew.h" /> <ClInclude Include="..\..\Common\DbgNew.h" />
<ClInclude Include="..\..\Common\ExceptionHandlerSetup.h" /> <ClInclude Include="..\..\Common\ExceptionHandlerSetup.h" />
<ClInclude Include="..\..\Common\GraphicsContext.h" /> <ClInclude Include="..\..\Common\GraphicsContext.h" />
<ClInclude Include="..\..\Common\Log.h" /> <ClInclude Include="..\..\Common\Log.h" />
<ClInclude Include="..\..\Common\LogManager.h" /> <ClInclude Include="..\..\Common\Log\LogManager.h" />
<ClInclude Include="..\..\Common\LogReporting.h" /> <ClInclude Include="..\..\Common\LogReporting.h" />
<ClInclude Include="..\..\Common\MemArena.h" /> <ClInclude Include="..\..\Common\MemArena.h" />
<ClInclude Include="..\..\Common\MemoryUtil.h" /> <ClInclude Include="..\..\Common\MemoryUtil.h" />

View File

@ -18,7 +18,7 @@
#include "Common/DirectXHelper.h" #include "Common/DirectXHelper.h"
#include "Common/File/FileUtil.h" #include "Common/File/FileUtil.h"
#include "Common/Log.h" #include "Common/Log.h"
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Common/TimeUtil.h" #include "Common/TimeUtil.h"
#include "Common/StringUtils.h" #include "Common/StringUtils.h"
#include "Common/System/Display.h" #include "Common/System/Display.h"

View File

@ -13,7 +13,7 @@
#include "Debugger_MemoryDlg.h" #include "Debugger_MemoryDlg.h"
#include "CtrlMemView.h" #include "CtrlMemView.h"
#include "DebuggerShared.h" #include "DebuggerShared.h"
#include "LogManager.h" #include "Common/Log.h"
#include "winnt.h" #include "winnt.h"
#include <WindowsX.h> #include <WindowsX.h>
#include <algorithm> #include <algorithm>

View File

@ -72,8 +72,8 @@
#include "Windows/resource.h" #include "Windows/resource.h"
#include "Windows/MainWindow.h" #include "Windows/MainWindow.h"
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Common/ConsoleListener.h" #include "Common/Log/ConsoleListener.h"
#include "Windows/W32Util/DialogManager.h" #include "Windows/W32Util/DialogManager.h"
#include "Windows/W32Util/ShellUtil.h" #include "Windows/W32Util/ShellUtil.h"
#include "Windows/W32Util/Misc.h" #include "Windows/W32Util/Misc.h"

View File

@ -19,8 +19,8 @@
#include "Common/System/Request.h" #include "Common/System/Request.h"
#include "Common/File/FileUtil.h" #include "Common/File/FileUtil.h"
#include "Common/Log.h" #include "Common/Log.h"
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Common/ConsoleListener.h" #include "Common/Log/ConsoleListener.h"
#include "Common/OSVersion.h" #include "Common/OSVersion.h"
#include "Common/GPU/Vulkan/VulkanLoader.h" #include "Common/GPU/Vulkan/VulkanLoader.h"
#include "Common/StringUtils.h" #include "Common/StringUtils.h"

View File

@ -55,8 +55,8 @@
#include "Windows/WindowsAudio.h" #include "Windows/WindowsAudio.h"
#include "ext/disarm.h" #include "ext/disarm.h"
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Common/ConsoleListener.h" #include "Common/Log/ConsoleListener.h"
#include "Common/StringUtils.h" #include "Common/StringUtils.h"
#include "Commctrl.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. // - 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. // - 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. // - 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) { if (debugLogLevel) {
LogManager::GetInstance()->SetAllLogLevels(LogLevel::LDEBUG); LogManager::GetInstance()->SetAllLogLevels(LogLevel::LDEBUG);

View File

@ -326,7 +326,7 @@ EXEC_AND_LIB_FILES := \
$(SRC)/Common/ExceptionHandlerSetup.cpp \ $(SRC)/Common/ExceptionHandlerSetup.cpp \
$(SRC)/Common/FakeCPUDetect.cpp \ $(SRC)/Common/FakeCPUDetect.cpp \
$(SRC)/Common/Log.cpp \ $(SRC)/Common/Log.cpp \
$(SRC)/Common/LogManager.cpp \ $(SRC)/Common/Log/LogManager.cpp \
$(SRC)/Common/LogReporting.cpp \ $(SRC)/Common/LogReporting.cpp \
$(SRC)/Common/MemArenaAndroid.cpp \ $(SRC)/Common/MemArenaAndroid.cpp \
$(SRC)/Common/MemArenaDarwin.cpp \ $(SRC)/Common/MemArenaDarwin.cpp \

View File

@ -5,7 +5,7 @@
#include <string> #include <string>
#include <cstdint> #include <cstdint>
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Common/File/DirListing.h" #include "Common/File/DirListing.h"
#include "Common/File/Path.h" #include "Common/File/Path.h"
#include "Common/File/AndroidStorage.h" #include "Common/File/AndroidStorage.h"

View File

@ -40,8 +40,8 @@
#include "Core/HLE/sceUtility.h" #include "Core/HLE/sceUtility.h"
#include "Core/SaveState.h" #include "Core/SaveState.h"
#include "GPU/Common/FramebufferManagerCommon.h" #include "GPU/Common/FramebufferManagerCommon.h"
#include "Log.h" #include "Common/Log.h"
#include "LogManager.h" #include "Common/Log/LogManager.h"
#include "Compare.h" #include "Compare.h"
#include "HeadlessHost.h" #include "HeadlessHost.h"

View File

@ -433,11 +433,12 @@ SOURCES_CXX += \
$(COMMONDIR)/ArmCPUDetect.cpp \ $(COMMONDIR)/ArmCPUDetect.cpp \
$(COMMONDIR)/CPUDetect.cpp \ $(COMMONDIR)/CPUDetect.cpp \
$(COMMONDIR)/Buffer.cpp \ $(COMMONDIR)/Buffer.cpp \
$(COMMONDIR)/ConsoleListener.cpp \ $(COMMONDIR)/Log/ConsoleListener.cpp \
$(COMMONDIR)/Log/StdioListener.cpp \
$(COMMONDIR)/ExceptionHandlerSetup.cpp \ $(COMMONDIR)/ExceptionHandlerSetup.cpp \
$(COMMONDIR)/FakeCPUDetect.cpp \ $(COMMONDIR)/FakeCPUDetect.cpp \
$(COMMONDIR)/Log.cpp \ $(COMMONDIR)/Log.cpp \
$(COMMONDIR)/LogManager.cpp \ $(COMMONDIR)/Log/LogManager.cpp \
$(COMMONDIR)/OSVersion.cpp \ $(COMMONDIR)/OSVersion.cpp \
$(COMMONDIR)/MemoryUtil.cpp \ $(COMMONDIR)/MemoryUtil.cpp \
$(COMMONDIR)/MipsCPUDetect.cpp \ $(COMMONDIR)/MipsCPUDetect.cpp \

View File

@ -9,14 +9,14 @@
#include "Common/CPUDetect.h" #include "Common/CPUDetect.h"
#include "Common/Log.h" #include "Common/Log.h"
#include "Common/LogManager.h" #include "Common/Log/LogManager.h"
#include "Common/System/Display.h" #include "Common/System/Display.h"
#include "Common/System/NativeApp.h" #include "Common/System/NativeApp.h"
#include "Common/System/System.h" #include "Common/System/System.h"
#include "Common/TimeUtil.h" #include "Common/TimeUtil.h"
#include "Common/File/FileUtil.h" #include "Common/File/FileUtil.h"
#include "Common/Serialize/Serializer.h" #include "Common/Serialize/Serializer.h"
#include "Common/ConsoleListener.h" #include "Common/Log/StdioListener.h"
#include "Common/Input/InputState.h" #include "Common/Input/InputState.h"
#include "Common/Thread/ThreadUtil.h" #include "Common/Thread/ThreadUtil.h"
#include "Common/Thread/ThreadManager.h" #include "Common/Thread/ThreadManager.h"
@ -1202,7 +1202,7 @@ void retro_init(void)
LogManager::Init(&g_Config.bEnableLogging); LogManager::Init(&g_Config.bEnableLogging);
printfLogger = new PrintfLogger(log); printfLogger = new PrintfLogger(log);
LogManager* logman = LogManager::GetInstance(); LogManager* logman = LogManager::GetInstance();
logman->RemoveListener(logman->GetConsoleListener()); logman->RemoveListener(logman->GetStdioListener());
logman->RemoveListener(logman->GetDebuggerListener()); logman->RemoveListener(logman->GetDebuggerListener());
logman->ChangeFileLog(nullptr); logman->ChangeFileLog(nullptr);
logman->AddListener(printfLogger); logman->AddListener(printfLogger);