Revert "Merge pull request #83 from lioncash/remove-console"

This breaks Linux stdout logging.

This reverts commit 7ac5b1f2f8, reversing
changes made to 9bc14012fc.

Revert "Merge pull request #77 from lioncash/remove-console"

This reverts commit 9bc14012fc, reversing
changes made to b18a33377d.

Conflicts:
	Source/Core/Common/LogManager.cpp
	Source/Core/DolphinWX/Frame.cpp
	Source/Core/DolphinWX/FrameAui.cpp
	Source/Core/DolphinWX/LogConfigWindow.cpp
	Source/Core/DolphinWX/LogWindow.cpp
This commit is contained in:
Pierre Bourdon
2014-02-23 07:33:03 +01:00
parent 60a5d8900b
commit 70f3a069f2
24 changed files with 834 additions and 17 deletions

View File

@ -12,6 +12,7 @@
#ifdef ANDROID
#include "Core/Host.h"
#endif
#include "Common/ConsoleListener.h"
#include "Common/FileUtil.h"
#include "Common/Log.h"
#include "Common/LogManager.h"
@ -82,11 +83,18 @@ LogManager::LogManager()
m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay");
m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX).c_str());
m_consoleLog = new ConsoleListener();
m_debuggerLog = new DebuggerLogListener();
for (LogContainer* container : m_Log)
{
container->SetEnable(true);
container->AddListener(m_fileLog);
container->AddListener(m_consoleLog);
#ifdef _MSC_VER
if (IsDebuggerPresent())
container->AddListener(m_debuggerLog);
#endif
}
}
@ -95,12 +103,16 @@ LogManager::~LogManager()
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
{
m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_fileLog);
m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_consoleLog);
m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_debuggerLog);
}
for (LogContainer* container : m_Log)
delete container;
delete m_fileLog;
delete m_consoleLog;
delete m_debuggerLog;
}
void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
@ -181,3 +193,10 @@ void FileLogListener::Log(LogTypes::LOG_LEVELS, const char *msg)
std::lock_guard<std::mutex> lk(m_log_lock);
m_logfile << msg << std::flush;
}
void DebuggerLogListener::Log(LogTypes::LOG_LEVELS, const char *msg)
{
#if _MSC_VER
::OutputDebugStringA(msg);
#endif
}