mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-05 15:40:10 +00:00
Logging fixed
Now it displays messagebox if logging system isn't initialized. Otherwise it could cause stack overflow.
This commit is contained in:
parent
5d6d058965
commit
c5737d01c6
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
using namespace Log;
|
using namespace Log;
|
||||||
|
|
||||||
LogManager *gLogManager = nullptr;
|
std::unique_ptr<LogManager> g_log_manager;
|
||||||
|
|
||||||
u32 LogMessage::size() const
|
u32 LogMessage::size() const
|
||||||
{
|
{
|
||||||
@ -224,6 +224,7 @@ void LogManager::addListener(std::shared_ptr<LogListener> listener)
|
|||||||
channel.addListener(listener);
|
channel.addListener(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogManager::removeListener(std::shared_ptr<LogListener> listener)
|
void LogManager::removeListener(std::shared_ptr<LogListener> listener)
|
||||||
{
|
{
|
||||||
for (auto& channel : mChannels)
|
for (auto& channel : mChannels)
|
||||||
@ -234,12 +235,14 @@ void LogManager::removeListener(std::shared_ptr<LogListener> listener)
|
|||||||
|
|
||||||
LogManager& LogManager::getInstance()
|
LogManager& LogManager::getInstance()
|
||||||
{
|
{
|
||||||
if (!gLogManager)
|
if (!g_log_manager)
|
||||||
{
|
{
|
||||||
gLogManager = new LogManager();
|
g_log_manager.reset(new LogManager());
|
||||||
}
|
}
|
||||||
return *gLogManager;
|
|
||||||
|
return *g_log_manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogChannel &LogManager::getChannel(LogType type)
|
LogChannel &LogManager::getChannel(LogType type)
|
||||||
{
|
{
|
||||||
return mChannels[static_cast<u32>(type)];
|
return mChannels[static_cast<u32>(type)];
|
||||||
@ -252,9 +255,22 @@ void log_message(Log::LogType type, Log::LogSeverity sev, const char* text)
|
|||||||
|
|
||||||
void log_message(Log::LogType type, Log::LogSeverity sev, std::string text)
|
void log_message(Log::LogType type, Log::LogSeverity sev, std::string text)
|
||||||
{
|
{
|
||||||
//another msvc bug makes this not work, uncomment this and delete everything else in this function when it's fixed
|
if (g_log_manager)
|
||||||
//Log::LogManager::getInstance().log({logType, severity, text})
|
{
|
||||||
|
// another msvc bug makes this not work, uncomment this when it's fixed
|
||||||
Log::LogMessage msg{ type, sev, std::move(text) };
|
//g_log_manager->log({logType, severity, text});
|
||||||
Log::LogManager::getInstance().log(msg);
|
Log::LogMessage msg{ type, sev, std::move(text) };
|
||||||
|
g_log_manager->log(msg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rMessageBox(text,
|
||||||
|
sev == Notice ? "Notice" :
|
||||||
|
sev == Warning ? "Warning" :
|
||||||
|
sev == Success ? "Success" :
|
||||||
|
sev == Error ? "Error" : "Unknown",
|
||||||
|
sev == Notice ? rICON_INFORMATION :
|
||||||
|
sev == Warning ? rICON_EXCLAMATION :
|
||||||
|
sev == Error ? rICON_ERROR : rICON_INFORMATION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
static std::thread::id main_thread;
|
|
||||||
|
|
||||||
class NamedThreadBase
|
class NamedThreadBase
|
||||||
{
|
{
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
|
@ -122,9 +122,9 @@ MainFrame::MainFrame()
|
|||||||
SetMenuBar(menubar);
|
SetMenuBar(menubar);
|
||||||
|
|
||||||
// Panels
|
// Panels
|
||||||
|
m_log_frame = new LogFrame(this);
|
||||||
m_game_viewer = new GameViewer(this);
|
m_game_viewer = new GameViewer(this);
|
||||||
m_debugger_frame = new DebuggerPanel(this);
|
m_debugger_frame = new DebuggerPanel(this);
|
||||||
m_log_frame = new LogFrame(this);
|
|
||||||
|
|
||||||
AddPane(m_game_viewer, "Game List", wxAUI_DOCK_CENTRE);
|
AddPane(m_game_viewer, "Game List", wxAUI_DOCK_CENTRE);
|
||||||
AddPane(m_log_frame, "Log", wxAUI_DOCK_BOTTOM);
|
AddPane(m_log_frame, "Log", wxAUI_DOCK_BOTTOM);
|
||||||
|
@ -148,8 +148,6 @@ bool Rpcs3App::OnInit()
|
|||||||
const wxString executablePath = wxPathOnly(wxStandardPaths::Get().GetExecutablePath());
|
const wxString executablePath = wxPathOnly(wxStandardPaths::Get().GetExecutablePath());
|
||||||
wxSetWorkingDirectory(executablePath);
|
wxSetWorkingDirectory(executablePath);
|
||||||
|
|
||||||
main_thread = std::this_thread::get_id();
|
|
||||||
|
|
||||||
Ini.Load();
|
Ini.Load();
|
||||||
Emu.Init();
|
Emu.Init();
|
||||||
Emu.SetEmulatorPath(executablePath.ToStdString());
|
Emu.SetEmulatorPath(executablePath.ToStdString());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user