mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-26 22:38:34 +00:00
Revert back to LogTypes. Fixes issue 3668.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6580 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
7c0e08b0e7
commit
35fef1f173
21 changed files with 172 additions and 159 deletions
|
@ -23,7 +23,7 @@
|
|||
#include "Thread.h"
|
||||
#include "FileUtil.h"
|
||||
|
||||
void GenericLog(enum LOG_LEVEL level, enum LOG_TYPE type,
|
||||
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
const char *file, int line, const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
@ -40,54 +40,54 @@ LogManager::LogManager() {
|
|||
logMutex = new Common::CriticalSection(1);
|
||||
|
||||
// create log files
|
||||
m_Log[MASTER_LOG] = new LogContainer("*", "Master Log");
|
||||
m_Log[BOOT] = new LogContainer("BOOT", "Boot");
|
||||
m_Log[COMMON] = new LogContainer("COMMON", "Common");
|
||||
m_Log[DISCIO] = new LogContainer("DIO", "Disc IO");
|
||||
m_Log[FILEMON] = new LogContainer("FileMon", "File Monitor");
|
||||
m_Log[PAD] = new LogContainer("PAD", "Pad");
|
||||
m_Log[PIXELENGINE] = new LogContainer("PE", "PixelEngine");
|
||||
m_Log[COMMANDPROCESSOR] = new LogContainer("CP", "CommandProc");
|
||||
m_Log[VIDEOINTERFACE] = new LogContainer("VI", "VideoInt");
|
||||
m_Log[SERIALINTERFACE] = new LogContainer("SI", "SerialInt");
|
||||
m_Log[PROCESSORINTERFACE] = new LogContainer("PI", "ProcessorInt");
|
||||
m_Log[MEMMAP] = new LogContainer("MI", "MI & memmap");
|
||||
m_Log[SP1] = new LogContainer("SP1", "Serial Port 1");
|
||||
m_Log[STREAMINGINTERFACE] = new LogContainer("Stream", "StreamingInt");
|
||||
m_Log[DSPINTERFACE] = new LogContainer("DSP", "DSPInterface");
|
||||
m_Log[DVDINTERFACE] = new LogContainer("DVD", "DVDInterface");
|
||||
m_Log[GPFIFO] = new LogContainer("GP", "GPFifo");
|
||||
m_Log[EXPANSIONINTERFACE] = new LogContainer("EXI", "ExpansionInt");
|
||||
m_Log[AUDIO_INTERFACE] = new LogContainer("AI", "AudioInt");
|
||||
m_Log[POWERPC] = new LogContainer("PowerPC", "IBM CPU");
|
||||
m_Log[OSHLE] = new LogContainer("HLE", "HLE");
|
||||
m_Log[DSPHLE] = new LogContainer("DSPHLE", "DSP HLE");
|
||||
m_Log[DSPLLE] = new LogContainer("DSPLLE", "DSP LLE");
|
||||
m_Log[DSP_MAIL] = new LogContainer("DSPMails", "DSP Mails");
|
||||
m_Log[VIDEO] = new LogContainer("Video", "Video Plugin");
|
||||
m_Log[AUDIO] = new LogContainer("Audio", "Audio Plugin");
|
||||
m_Log[DYNA_REC] = new LogContainer("JIT", "Dynamic Recompiler");
|
||||
m_Log[CONSOLE] = new LogContainer("CONSOLE", "Dolphin Console");
|
||||
m_Log[OSREPORT] = new LogContainer("OSREPORT", "OSReport");
|
||||
m_Log[WIIMOTE] = new LogContainer("Wiimote", "Wiimote Plugin");
|
||||
m_Log[WII_IOB] = new LogContainer("WII_IOB", "WII IO Bridge");
|
||||
m_Log[WII_IPC] = new LogContainer("WII_IPC", "WII IPC");
|
||||
m_Log[WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE");
|
||||
m_Log[WII_IPC_DVD] = new LogContainer("WII_IPC_DVD", "WII IPC DVD");
|
||||
m_Log[WII_IPC_ES] = new LogContainer("WII_IPC_ES", "WII IPC ES");
|
||||
m_Log[WII_IPC_FILEIO] = new LogContainer("WII_IPC_FILEIO", "WII IPC FILEIO");
|
||||
m_Log[WII_IPC_SD] = new LogContainer("WII_IPC_SD", "WII IPC SD");
|
||||
m_Log[WII_IPC_STM] = new LogContainer("WII_IPC_STM", "WII IPC STM");
|
||||
m_Log[WII_IPC_NET] = new LogContainer("WII_IPC_NET", "WII IPC NET");
|
||||
m_Log[WII_IPC_WIIMOTE] = new LogContainer("WII_IPC_WIIMOTE", "WII IPC WIIMOTE");
|
||||
m_Log[ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay");
|
||||
m_Log[MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager");
|
||||
m_Log[NETPLAY] = new LogContainer("NETPLAY", "Netplay");
|
||||
m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log");
|
||||
m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot");
|
||||
m_Log[LogTypes::COMMON] = new LogContainer("COMMON", "Common");
|
||||
m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO");
|
||||
m_Log[LogTypes::FILEMON] = new LogContainer("FileMon", "File Monitor");
|
||||
m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad");
|
||||
m_Log[LogTypes::PIXELENGINE] = new LogContainer("PE", "PixelEngine");
|
||||
m_Log[LogTypes::COMMANDPROCESSOR] = new LogContainer("CP", "CommandProc");
|
||||
m_Log[LogTypes::VIDEOINTERFACE] = new LogContainer("VI", "VideoInt");
|
||||
m_Log[LogTypes::SERIALINTERFACE] = new LogContainer("SI", "SerialInt");
|
||||
m_Log[LogTypes::PROCESSORINTERFACE] = new LogContainer("PI", "ProcessorInt");
|
||||
m_Log[LogTypes::MEMMAP] = new LogContainer("MI", "MI & memmap");
|
||||
m_Log[LogTypes::SP1] = new LogContainer("SP1", "Serial Port 1");
|
||||
m_Log[LogTypes::STREAMINGINTERFACE] = new LogContainer("Stream", "StreamingInt");
|
||||
m_Log[LogTypes::DSPINTERFACE] = new LogContainer("DSP", "DSPInterface");
|
||||
m_Log[LogTypes::DVDINTERFACE] = new LogContainer("DVD", "DVDInterface");
|
||||
m_Log[LogTypes::GPFIFO] = new LogContainer("GP", "GPFifo");
|
||||
m_Log[LogTypes::EXPANSIONINTERFACE] = new LogContainer("EXI", "ExpansionInt");
|
||||
m_Log[LogTypes::AUDIO_INTERFACE] = new LogContainer("AI", "AudioInt");
|
||||
m_Log[LogTypes::POWERPC] = new LogContainer("PowerPC", "IBM CPU");
|
||||
m_Log[LogTypes::OSHLE] = new LogContainer("HLE", "HLE");
|
||||
m_Log[LogTypes::DSPHLE] = new LogContainer("DSPHLE", "DSP HLE");
|
||||
m_Log[LogTypes::DSPLLE] = new LogContainer("DSPLLE", "DSP LLE");
|
||||
m_Log[LogTypes::DSP_MAIL] = new LogContainer("DSPMails", "DSP Mails");
|
||||
m_Log[LogTypes::VIDEO] = new LogContainer("Video", "Video Plugin");
|
||||
m_Log[LogTypes::AUDIO] = new LogContainer("Audio", "Audio Plugin");
|
||||
m_Log[LogTypes::DYNA_REC] = new LogContainer("JIT", "Dynamic Recompiler");
|
||||
m_Log[LogTypes::CONSOLE] = new LogContainer("CONSOLE", "Dolphin Console");
|
||||
m_Log[LogTypes::OSREPORT] = new LogContainer("OSREPORT", "OSReport");
|
||||
m_Log[LogTypes::WIIMOTE] = new LogContainer("Wiimote", "Wiimote Plugin");
|
||||
m_Log[LogTypes::WII_IOB] = new LogContainer("WII_IOB", "WII IO Bridge");
|
||||
m_Log[LogTypes::WII_IPC] = new LogContainer("WII_IPC", "WII IPC");
|
||||
m_Log[LogTypes::WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE");
|
||||
m_Log[LogTypes::WII_IPC_DVD] = new LogContainer("WII_IPC_DVD", "WII IPC DVD");
|
||||
m_Log[LogTypes::WII_IPC_ES] = new LogContainer("WII_IPC_ES", "WII IPC ES");
|
||||
m_Log[LogTypes::WII_IPC_FILEIO] = new LogContainer("WII_IPC_FILEIO","WII IPC FILEIO");
|
||||
m_Log[LogTypes::WII_IPC_SD] = new LogContainer("WII_IPC_SD", "WII IPC SD");
|
||||
m_Log[LogTypes::WII_IPC_STM] = new LogContainer("WII_IPC_STM", "WII IPC STM");
|
||||
m_Log[LogTypes::WII_IPC_NET] = new LogContainer("WII_IPC_NET", "WII IPC NET");
|
||||
m_Log[LogTypes::WII_IPC_WIIMOTE] = new LogContainer("WII_IPC_WIIMOTE","WII IPC WIIMOTE");
|
||||
m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay");
|
||||
m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager");
|
||||
m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay");
|
||||
|
||||
m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX));
|
||||
m_consoleLog = new ConsoleListener();
|
||||
|
||||
for (int i = 0; i < NUMBER_OF_LOGS; ++i) {
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) {
|
||||
m_Log[i]->setEnable(true);
|
||||
m_Log[i]->addListener(m_fileLog);
|
||||
m_Log[i]->addListener(m_consoleLog);
|
||||
|
@ -95,12 +95,12 @@ LogManager::LogManager() {
|
|||
}
|
||||
|
||||
LogManager::~LogManager() {
|
||||
for (int i = 0; i < NUMBER_OF_LOGS; ++i) {
|
||||
m_logManager->removeListener(i, m_fileLog);
|
||||
m_logManager->removeListener(i, m_consoleLog);
|
||||
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);
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUMBER_OF_LOGS; ++i)
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
delete m_Log[i];
|
||||
|
||||
delete m_fileLog;
|
||||
|
@ -108,8 +108,9 @@ LogManager::~LogManager() {
|
|||
delete logMutex;
|
||||
}
|
||||
|
||||
void LogManager::Log(enum LOG_LEVEL level, enum LOG_TYPE type,
|
||||
const char *file, int line, const char *format, va_list args) {
|
||||
void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
const char *file, int line, const char *format,
|
||||
va_list args) {
|
||||
|
||||
char temp[MAX_MSGLEN];
|
||||
char msg[MAX_MSGLEN * 2];
|
||||
|
@ -131,7 +132,7 @@ void LogManager::Log(enum LOG_LEVEL level, enum LOG_TYPE type,
|
|||
logMutex->Leave();
|
||||
}
|
||||
|
||||
void LogManager::removeListener(int type, LogListener *listener) {
|
||||
void LogManager::removeListener(LogTypes::LOG_TYPE type, LogListener *listener) {
|
||||
logMutex->Enter();
|
||||
m_Log[type]->removeListener(listener);
|
||||
logMutex->Leave();
|
||||
|
@ -152,7 +153,7 @@ LogContainer::LogContainer(const char* shortName, const char* fullName, bool ena
|
|||
: m_enable(enable) {
|
||||
strncpy(m_fullName, fullName, 128);
|
||||
strncpy(m_shortName, shortName, 32);
|
||||
m_level = MAX_LOGLEVEL;
|
||||
m_level = LogTypes::LWARNING;
|
||||
}
|
||||
|
||||
// LogContainer
|
||||
|
@ -171,7 +172,7 @@ bool LogContainer::isListener(LogListener *listener) const {
|
|||
return listeners.end() != std::find(listeners.begin(), listeners.end(), listener);
|
||||
}
|
||||
|
||||
void LogContainer::trigger(enum LOG_LEVEL level, const char *msg) {
|
||||
void LogContainer::trigger(LogTypes::LOG_LEVELS level, const char *msg) {
|
||||
std::vector<LogListener *>::const_iterator i;
|
||||
for (i = listeners.begin(); i != listeners.end(); ++i) {
|
||||
(*i)->Log(level, msg);
|
||||
|
@ -190,10 +191,10 @@ FileLogListener::~FileLogListener() {
|
|||
fclose(m_logfile);
|
||||
}
|
||||
|
||||
void FileLogListener::Log(enum LOG_LEVEL, const char *msg) {
|
||||
void FileLogListener::Log(LogTypes::LOG_LEVELS, const char *msg) {
|
||||
if (!m_enable || !isValid())
|
||||
return;
|
||||
|
||||
fwrite(msg, strlen(msg) * sizeof(char), 1, m_logfile);
|
||||
fwrite(msg, strlen(msg) * sizeof(char), 1, m_logfile);
|
||||
fflush(m_logfile);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue