mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Common: Kill off duplicate log warning definitions
Also embed the log checks rather than using macros
This commit is contained in:
parent
48f52b9662
commit
690ed8580c
@ -257,19 +257,19 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
|
|||||||
|
|
||||||
switch (Level)
|
switch (Level)
|
||||||
{
|
{
|
||||||
case NOTICE_LEVEL: // light green
|
case LogTypes::LOG_LEVELS::LNOTICE: // light green
|
||||||
Color = FOREGROUND_GREEN | FOREGROUND_INTENSITY;
|
Color = FOREGROUND_GREEN | FOREGROUND_INTENSITY;
|
||||||
break;
|
break;
|
||||||
case ERROR_LEVEL: // light red
|
case LogTypes::LOG_LEVELS::LERROR: // light red
|
||||||
Color = FOREGROUND_RED | FOREGROUND_INTENSITY;
|
Color = FOREGROUND_RED | FOREGROUND_INTENSITY;
|
||||||
break;
|
break;
|
||||||
case WARNING_LEVEL: // light yellow
|
case LogTypes::LOG_LEVELS::LWARNING: // light yellow
|
||||||
Color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
|
Color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
|
||||||
break;
|
break;
|
||||||
case INFO_LEVEL: // cyan
|
case LogTypes::LOG_LEVELS::LINFO: // cyan
|
||||||
Color = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY;
|
Color = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY;
|
||||||
break;
|
break;
|
||||||
case DEBUG_LEVEL: // gray
|
case LogTypes::LOG_LEVELS::LDEBUG: // gray
|
||||||
Color = FOREGROUND_INTENSITY;
|
Color = FOREGROUND_INTENSITY;
|
||||||
break;
|
break;
|
||||||
default: // off-white
|
default: // off-white
|
||||||
@ -294,13 +294,13 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
|
|||||||
strcpy(ResetAttr, "\033[0m");
|
strcpy(ResetAttr, "\033[0m");
|
||||||
switch (Level)
|
switch (Level)
|
||||||
{
|
{
|
||||||
case NOTICE_LEVEL: // light green
|
case LogTypes::LOG_LEVELS::LNOTICE: // light green
|
||||||
strcpy(ColorAttr, "\033[92m");
|
strcpy(ColorAttr, "\033[92m");
|
||||||
break;
|
break;
|
||||||
case ERROR_LEVEL: // light red
|
case LogTypes::LOG_LEVELS::LERROR: // light red
|
||||||
strcpy(ColorAttr, "\033[91m");
|
strcpy(ColorAttr, "\033[91m");
|
||||||
break;
|
break;
|
||||||
case WARNING_LEVEL: // light yellow
|
case LogTypes::LOG_LEVELS::LWARNING: // light yellow
|
||||||
strcpy(ColorAttr, "\033[93m");
|
strcpy(ColorAttr, "\033[93m");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -4,12 +4,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define NOTICE_LEVEL 1 // VERY important information that is NOT errors. Like startup and OSReports.
|
|
||||||
#define ERROR_LEVEL 2 // Critical errors
|
|
||||||
#define WARNING_LEVEL 3 // Something is suspicious.
|
|
||||||
#define INFO_LEVEL 4 // General information.
|
|
||||||
#define DEBUG_LEVEL 5 // Detailed debugging - might make things slow.
|
|
||||||
|
|
||||||
namespace LogTypes
|
namespace LogTypes
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -65,14 +59,13 @@ enum LOG_TYPE
|
|||||||
NUMBER_OF_LOGS // Must be last
|
NUMBER_OF_LOGS // Must be last
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: should this be removed?
|
|
||||||
enum LOG_LEVELS
|
enum LOG_LEVELS
|
||||||
{
|
{
|
||||||
LNOTICE = NOTICE_LEVEL,
|
LNOTICE = 1, // VERY important information that is NOT errors. Like startup and OSReports.
|
||||||
LERROR = ERROR_LEVEL,
|
LERROR = 2, // Critical errors
|
||||||
LWARNING = WARNING_LEVEL,
|
LWARNING = 3, // Something is suspicious.
|
||||||
LINFO = INFO_LEVEL,
|
LINFO = 4, // General information.
|
||||||
LDEBUG = DEBUG_LEVEL,
|
LDEBUG = 5, // Detailed debugging - might make things slow.
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char LOG_LEVEL_TO_CHAR[7] = "-NEWID";
|
static const char LOG_LEVEL_TO_CHAR[7] = "-NEWID";
|
||||||
@ -87,10 +80,10 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
|||||||
;
|
;
|
||||||
|
|
||||||
#if defined LOGGING || defined _DEBUG || defined DEBUGFAST
|
#if defined LOGGING || defined _DEBUG || defined DEBUGFAST
|
||||||
#define MAX_LOGLEVEL DEBUG_LEVEL
|
#define MAX_LOGLEVEL LogTypes::LOG_LEVELS::LDEBUG
|
||||||
#else
|
#else
|
||||||
#ifndef MAX_LOGLEVEL
|
#ifndef MAX_LOGLEVEL
|
||||||
#define MAX_LOGLEVEL WARNING_LEVEL
|
#define MAX_LOGLEVEL LogTypes::LOG_LEVELS::LWARNING
|
||||||
#endif // loglevel
|
#endif // loglevel
|
||||||
#endif // logging
|
#endif // logging
|
||||||
|
|
||||||
@ -110,24 +103,30 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
|||||||
#define INFO_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) } while (0)
|
#define INFO_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) } while (0)
|
||||||
#define DEBUG_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) } while (0)
|
#define DEBUG_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) } while (0)
|
||||||
|
|
||||||
#if MAX_LOGLEVEL >= DEBUG_LEVEL
|
|
||||||
#define _dbg_assert_(_t_, _a_) \
|
#define _dbg_assert_(_t_, _a_) \
|
||||||
if (!(_a_)) {\
|
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG && !(_a_)) {\
|
||||||
ERROR_LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
|
ERROR_LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
|
||||||
__LINE__, __FILE__, __TIME__); \
|
__LINE__, __FILE__, __TIME__); \
|
||||||
if (!PanicYesNo("*** Assertion (see log)***\n")) {Crash();} \
|
if (!PanicYesNo("*** Assertion (see log)***\n")) \
|
||||||
|
Crash(); \
|
||||||
}
|
}
|
||||||
#define _dbg_assert_msg_(_t_, _a_, ...)\
|
|
||||||
if (!(_a_)) {\
|
#ifdef _WIN32
|
||||||
ERROR_LOG(_t_, __VA_ARGS__); \
|
#define _dbg_assert_msg_(_t_, _a_, _msg_, ...)\
|
||||||
if (!PanicYesNo(__VA_ARGS__)) {Crash();} \
|
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG && !(_a_)) {\
|
||||||
|
ERROR_LOG(_t_, _msg_, __VA_ARGS__); \
|
||||||
|
if (!PanicYesNo(_msg_, __VA_ARGS__)) \
|
||||||
|
Crash(); \
|
||||||
}
|
}
|
||||||
#else // not debug
|
#else
|
||||||
#ifndef _dbg_assert_
|
#define _dbg_assert_msg_(_t_, _a_, _msg_, ...)\
|
||||||
#define _dbg_assert_(_t_, _a_) {}
|
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG && !(_a_)) {\
|
||||||
#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) {}
|
ERROR_LOG(_t_, _msg_, ##__VA_ARGS__); \
|
||||||
#endif // dbg_assert
|
if (!PanicYesNo(_msg_, ##__VA_ARGS__)) \
|
||||||
#endif // MAX_LOGLEVEL DEBUG
|
Crash(); \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
|
#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
|
||||||
|
|
||||||
@ -135,12 +134,14 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
|
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
|
||||||
if (!(_a_)) {\
|
if (!(_a_)) {\
|
||||||
if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \
|
if (!PanicYesNo(_fmt_, __VA_ARGS__)) \
|
||||||
|
Crash(); \
|
||||||
}
|
}
|
||||||
#else // not win32
|
#else // not win32
|
||||||
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
|
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
|
||||||
if (!(_a_)) {\
|
if (!(_a_)) {\
|
||||||
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \
|
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) \
|
||||||
|
Crash(); \
|
||||||
}
|
}
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
#else // GEKKO
|
#else // GEKKO
|
||||||
|
@ -209,9 +209,8 @@ protected:
|
|||||||
GENERIC_LOG(LogType, LogTypes::LINFO, " OutBuffer: 0x%08x (0x%x):",
|
GENERIC_LOG(LogType, LogTypes::LINFO, " OutBuffer: 0x%08x (0x%x):",
|
||||||
OutBuffer, OutBufferSize);
|
OutBuffer, OutBufferSize);
|
||||||
|
|
||||||
#if defined(MAX_LOGLEVEL) && MAX_LOGLEVEL >= INFO_LEVEL
|
if (Verbosity >= LogTypes::LOG_LEVELS::LINFO)
|
||||||
DumpCommands(OutBuffer, OutBufferSize, LogType, Verbosity);
|
DumpCommands(OutBuffer, OutBufferSize, LogType, Verbosity);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -710,12 +710,11 @@ static int ParseAttribList(u8* pAttribIDList, u16& _startID, u16& _endID)
|
|||||||
u8 seqSize = attribList.Read8(attribOffset); attribOffset++;
|
u8 seqSize = attribList.Read8(attribOffset); attribOffset++;
|
||||||
u8 typeID = attribList.Read8(attribOffset); attribOffset++;
|
u8 typeID = attribList.Read8(attribOffset); attribOffset++;
|
||||||
|
|
||||||
#if MAX_LOGLEVEL >= DEBUG_LEVEL
|
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG)
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, sequence == SDP_SEQ8);
|
{
|
||||||
(void)seqSize;
|
_dbg_assert_(WII_IPC_WIIMOTE, sequence == SDP_SEQ8);
|
||||||
#else
|
(void)seqSize;
|
||||||
(void)sequence, (void)seqSize;
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (typeID == SDP_UINT32)
|
if (typeID == SDP_UINT32)
|
||||||
{
|
{
|
||||||
|
@ -102,11 +102,8 @@ bool WiiWAD::ParseWAD(DiscIO::IBlobReader& _rReader)
|
|||||||
m_DataAppSize = ReaderBig.Read32(0x18);
|
m_DataAppSize = ReaderBig.Read32(0x18);
|
||||||
m_FooterSize = ReaderBig.Read32(0x1C);
|
m_FooterSize = ReaderBig.Read32(0x1C);
|
||||||
|
|
||||||
#if MAX_LOGLEVEL >= DEBUG_LEVEL
|
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG)
|
||||||
_dbg_assert_msg_(BOOT, Reserved==0x00, "WiiWAD: Reserved must be 0x00");
|
_dbg_assert_msg_(BOOT, Reserved==0x00, "WiiWAD: Reserved must be 0x00");
|
||||||
#else
|
|
||||||
(void)Reserved;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
u32 Offset = 0x40;
|
u32 Offset = 0x40;
|
||||||
m_pCertificateChain = CreateWADEntry(_rReader, m_CertificateChainSize, Offset); Offset += ROUND_UP(m_CertificateChainSize, 0x40);
|
m_pCertificateChain = CreateWADEntry(_rReader, m_CertificateChainSize, Offset); Offset += ROUND_UP(m_CertificateChainSize, 0x40);
|
||||||
|
@ -314,23 +314,23 @@ void CLogWindow::UpdateLog()
|
|||||||
{
|
{
|
||||||
switch (msgQueue.front().first)
|
switch (msgQueue.front().first)
|
||||||
{
|
{
|
||||||
case ERROR_LEVEL:
|
case LogTypes::LOG_LEVELS::LERROR:
|
||||||
m_Log->SetDefaultStyle(wxTextAttr(*wxRED));
|
m_Log->SetDefaultStyle(wxTextAttr(*wxRED));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WARNING_LEVEL:
|
case LogTypes::LOG_LEVELS::LWARNING:
|
||||||
m_Log->SetDefaultStyle(wxTextAttr(*wxYELLOW));
|
m_Log->SetDefaultStyle(wxTextAttr(*wxYELLOW));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NOTICE_LEVEL:
|
case LogTypes::LOG_LEVELS::LNOTICE:
|
||||||
m_Log->SetDefaultStyle(wxTextAttr(*wxGREEN));
|
m_Log->SetDefaultStyle(wxTextAttr(*wxGREEN));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INFO_LEVEL:
|
case LogTypes::LOG_LEVELS::LINFO:
|
||||||
m_Log->SetDefaultStyle(wxTextAttr(*wxCYAN));
|
m_Log->SetDefaultStyle(wxTextAttr(*wxCYAN));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_LEVEL:
|
case LogTypes::LOG_LEVELS::LDEBUG:
|
||||||
m_Log->SetDefaultStyle(wxTextAttr(*wxLIGHT_GREY));
|
m_Log->SetDefaultStyle(wxTextAttr(*wxLIGHT_GREY));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user