Convert LOG_TYPE and LOG_LEVELS to enum class
This commit is contained in:
parent
ba107819ec
commit
04d8cdfe88
|
@ -1336,7 +1336,7 @@ public final class SettingsFragmentPresenter
|
|||
|
||||
private static int getLogVerbosityEntries()
|
||||
{
|
||||
// Value obtained from LOG_LEVELS in Common/Logging/Log.h
|
||||
// Value obtained from LogLevel in Common/Logging/Log.h
|
||||
if (NativeLibrary.GetMaxLogLevel() == 5)
|
||||
{
|
||||
return R.array.logVerbosityEntriesMaxLevelDebug;
|
||||
|
@ -1349,7 +1349,7 @@ public final class SettingsFragmentPresenter
|
|||
|
||||
private static int getLogVerbosityValues()
|
||||
{
|
||||
// Value obtained from LOG_LEVELS in Common/Logging/Log.h
|
||||
// Value obtained from LogLevel in Common/Logging/Log.h
|
||||
if (NativeLibrary.GetMaxLogLevel() == 5)
|
||||
{
|
||||
return R.array.logVerbosityValuesMaxLevelDebug;
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
<item>0</item>
|
||||
</integer-array>
|
||||
|
||||
<!-- Log Verbosity selection based on LOG_LEVELS in Common/Logging/Log.h -->
|
||||
<!-- Log Verbosity selection based on LogLevel in Common/Logging/Log.h -->
|
||||
<string-array name="logVerbosityEntriesMaxLevelInfo" translatable="false">
|
||||
<item>Notice</item>
|
||||
<item>Error</item>
|
||||
|
|
|
@ -29,7 +29,8 @@ static void LogCallback(const char* format, ...)
|
|||
const std::string message = StringFromFormatV(adapted_format.c_str(), args);
|
||||
va_end(args);
|
||||
|
||||
instance->Log(Common::Log::LNOTICE, Common::Log::AUDIO, filename, lineno, message.c_str());
|
||||
instance->Log(Common::Log::LogLevel::LNOTICE, Common::Log::LogType::AUDIO, filename, lineno,
|
||||
message.c_str());
|
||||
}
|
||||
|
||||
static void DestroyContext(cubeb* ctx)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#define DEBUG_ASSERT_MSG(_t_, _a_, _msg_, ...) \
|
||||
do \
|
||||
{ \
|
||||
if constexpr (Common::Log::MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG) \
|
||||
if constexpr (Common::Log::MAX_LOGLEVEL >= Common::Log::LogLevel::LDEBUG) \
|
||||
{ \
|
||||
if (!(_a_)) \
|
||||
{ \
|
||||
|
@ -43,6 +43,6 @@
|
|||
#define DEBUG_ASSERT(_a_) \
|
||||
do \
|
||||
{ \
|
||||
if constexpr (Common::Log::MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG) \
|
||||
if constexpr (Common::Log::MAX_LOGLEVEL >= Common::Log::LogLevel::LDEBUG) \
|
||||
ASSERT(_a_); \
|
||||
} while (0)
|
||||
|
|
|
@ -11,7 +11,7 @@ public:
|
|||
ConsoleListener();
|
||||
~ConsoleListener();
|
||||
|
||||
void Log(Common::Log::LOG_LEVELS level, const char* text) override;
|
||||
void Log(Common::Log::LogLevel level, const char* text) override;
|
||||
|
||||
private:
|
||||
bool m_use_color = false;
|
||||
|
|
|
@ -13,26 +13,26 @@ ConsoleListener::~ConsoleListener()
|
|||
{
|
||||
}
|
||||
|
||||
void ConsoleListener::Log(Common::Log::LOG_LEVELS level, const char* text)
|
||||
void ConsoleListener::Log(Common::Log::LogLevel level, const char* text)
|
||||
{
|
||||
android_LogPriority logLevel = ANDROID_LOG_UNKNOWN;
|
||||
|
||||
// Map dolphin's log levels to android's
|
||||
switch (level)
|
||||
{
|
||||
case Common::Log::LOG_LEVELS::LDEBUG:
|
||||
case Common::Log::LogLevel::LDEBUG:
|
||||
logLevel = ANDROID_LOG_DEBUG;
|
||||
break;
|
||||
case Common::Log::LOG_LEVELS::LINFO:
|
||||
case Common::Log::LogLevel::LINFO:
|
||||
logLevel = ANDROID_LOG_INFO;
|
||||
break;
|
||||
case Common::Log::LOG_LEVELS::LWARNING:
|
||||
case Common::Log::LogLevel::LWARNING:
|
||||
logLevel = ANDROID_LOG_WARN;
|
||||
break;
|
||||
case Common::Log::LOG_LEVELS::LERROR:
|
||||
case Common::Log::LogLevel::LERROR:
|
||||
logLevel = ANDROID_LOG_ERROR;
|
||||
break;
|
||||
case Common::Log::LOG_LEVELS::LNOTICE:
|
||||
case Common::Log::LogLevel::LNOTICE:
|
||||
logLevel = ANDROID_LOG_INFO;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ ConsoleListener::~ConsoleListener()
|
|||
fflush(nullptr);
|
||||
}
|
||||
|
||||
void ConsoleListener::Log(Common::Log::LOG_LEVELS level, const char* text)
|
||||
void ConsoleListener::Log(Common::Log::LogLevel level, const char* text)
|
||||
{
|
||||
char color_attr[16] = "";
|
||||
char reset_attr[16] = "";
|
||||
|
@ -31,15 +31,15 @@ void ConsoleListener::Log(Common::Log::LOG_LEVELS level, const char* text)
|
|||
strcpy(reset_attr, "\x1b[0m");
|
||||
switch (level)
|
||||
{
|
||||
case Common::Log::LOG_LEVELS::LNOTICE:
|
||||
case Common::Log::LogLevel::LNOTICE:
|
||||
// light green
|
||||
strcpy(color_attr, "\x1b[92m");
|
||||
break;
|
||||
case Common::Log::LOG_LEVELS::LERROR:
|
||||
case Common::Log::LogLevel::LERROR:
|
||||
// light red
|
||||
strcpy(color_attr, "\x1b[91m");
|
||||
break;
|
||||
case Common::Log::LOG_LEVELS::LWARNING:
|
||||
case Common::Log::LogLevel::LWARNING:
|
||||
// light yellow
|
||||
strcpy(color_attr, "\x1b[93m");
|
||||
break;
|
||||
|
|
|
@ -14,7 +14,7 @@ ConsoleListener::~ConsoleListener()
|
|||
{
|
||||
}
|
||||
|
||||
void ConsoleListener::Log([[maybe_unused]] Common::Log::LOG_LEVELS level, const char* text)
|
||||
void ConsoleListener::Log([[maybe_unused]] Common::Log::LogLevel level, const char* text)
|
||||
{
|
||||
::OutputDebugStringW(UTF8ToWString(text).c_str());
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace Common::Log
|
||||
{
|
||||
enum LOG_TYPE
|
||||
enum class LogType : int
|
||||
{
|
||||
ACTIONREPLAY,
|
||||
AUDIO,
|
||||
|
@ -67,7 +67,7 @@ enum LOG_TYPE
|
|||
NUMBER_OF_LOGS // Must be last
|
||||
};
|
||||
|
||||
enum LOG_LEVELS
|
||||
enum class LogLevel : int
|
||||
{
|
||||
LNOTICE = 1, // VERY important information that is NOT errors. Like startup and OSReports.
|
||||
LERROR = 2, // Critical errors
|
||||
|
@ -77,18 +77,18 @@ enum LOG_LEVELS
|
|||
};
|
||||
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
constexpr auto MAX_LOGLEVEL = Common::Log::LOG_LEVELS::LDEBUG;
|
||||
constexpr auto MAX_LOGLEVEL = Common::Log::LogLevel::LDEBUG;
|
||||
#else
|
||||
constexpr auto MAX_LOGLEVEL = Common::Log::LOG_LEVELS::LINFO;
|
||||
constexpr auto MAX_LOGLEVEL = Common::Log::LogLevel::LINFO;
|
||||
#endif // logging
|
||||
|
||||
static const char LOG_LEVEL_TO_CHAR[7] = "-NEWID";
|
||||
|
||||
void GenericLogFmtImpl(LOG_LEVELS level, LOG_TYPE type, const char* file, int line,
|
||||
void GenericLogFmtImpl(LogLevel level, LogType type, const char* file, int line,
|
||||
fmt::string_view format, const fmt::format_args& args);
|
||||
|
||||
template <std::size_t NumFields, typename S, typename... Args>
|
||||
void GenericLogFmt(LOG_LEVELS level, LOG_TYPE type, const char* file, int line, const S& format,
|
||||
void GenericLogFmt(LogLevel level, LogType type, const char* file, int line, const S& format,
|
||||
const Args&... args)
|
||||
{
|
||||
static_assert(NumFields == sizeof...(args),
|
||||
|
@ -98,7 +98,7 @@ void GenericLogFmt(LOG_LEVELS level, LOG_TYPE type, const char* file, int line,
|
|||
fmt::make_args_checked<Args...>(format, args...));
|
||||
}
|
||||
|
||||
void GenericLog(LOG_LEVELS level, LOG_TYPE type, const char* file, int line, const char* fmt, ...)
|
||||
void GenericLog(LogLevel level, LogType type, const char* file, int line, const char* fmt, ...)
|
||||
#ifdef __GNUC__
|
||||
__attribute__((format(printf, 5, 6)))
|
||||
#endif
|
||||
|
@ -116,27 +116,27 @@ void GenericLog(LOG_LEVELS level, LOG_TYPE type, const char* file, int line, con
|
|||
#define ERROR_LOG(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG(Common::Log::t, Common::Log::LERROR, __VA_ARGS__); \
|
||||
GENERIC_LOG(Common::Log::LogType::t, Common::Log::LogLevel::LERROR, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define WARN_LOG(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG(Common::Log::t, Common::Log::LWARNING, __VA_ARGS__); \
|
||||
GENERIC_LOG(Common::Log::LogType::t, Common::Log::LogLevel::LWARNING, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define NOTICE_LOG(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG(Common::Log::t, Common::Log::LNOTICE, __VA_ARGS__); \
|
||||
GENERIC_LOG(Common::Log::LogType::t, Common::Log::LogLevel::LNOTICE, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define INFO_LOG(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG(Common::Log::t, Common::Log::LINFO, __VA_ARGS__); \
|
||||
GENERIC_LOG(Common::Log::LogType::t, Common::Log::LogLevel::LINFO, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define DEBUG_LOG(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG(Common::Log::t, Common::Log::LDEBUG, __VA_ARGS__); \
|
||||
GENERIC_LOG(Common::Log::LogType::t, Common::Log::LogLevel::LDEBUG, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
// fmtlib capable API
|
||||
|
@ -156,25 +156,25 @@ void GenericLog(LOG_LEVELS level, LOG_TYPE type, const char* file, int line, con
|
|||
#define ERROR_LOG_FMT(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG_FMT(Common::Log::t, Common::Log::LERROR, __VA_ARGS__); \
|
||||
GENERIC_LOG_FMT(Common::Log::LogType::t, Common::Log::LogLevel::LERROR, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define WARN_LOG_FMT(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG_FMT(Common::Log::t, Common::Log::LWARNING, __VA_ARGS__); \
|
||||
GENERIC_LOG_FMT(Common::Log::LogType::t, Common::Log::LogLevel::LWARNING, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define NOTICE_LOG_FMT(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG_FMT(Common::Log::t, Common::Log::LNOTICE, __VA_ARGS__); \
|
||||
GENERIC_LOG_FMT(Common::Log::LogType::t, Common::Log::LogLevel::LNOTICE, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define INFO_LOG_FMT(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG_FMT(Common::Log::t, Common::Log::LINFO, __VA_ARGS__); \
|
||||
GENERIC_LOG_FMT(Common::Log::LogType::t, Common::Log::LogLevel::LINFO, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define DEBUG_LOG_FMT(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG_FMT(Common::Log::t, Common::Log::LDEBUG, __VA_ARGS__); \
|
||||
GENERIC_LOG_FMT(Common::Log::LogType::t, Common::Log::LogLevel::LDEBUG, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
|
|
@ -31,7 +31,8 @@ const Config::Info<bool> LOGGER_WRITE_TO_CONSOLE{
|
|||
{Config::System::Logger, "Options", "WriteToConsole"}, true};
|
||||
const Config::Info<bool> LOGGER_WRITE_TO_WINDOW{
|
||||
{Config::System::Logger, "Options", "WriteToWindow"}, true};
|
||||
const Config::Info<int> LOGGER_VERBOSITY{{Config::System::Logger, "Options", "Verbosity"}, 0};
|
||||
const Config::Info<LogLevel> LOGGER_VERBOSITY{{Config::System::Logger, "Options", "Verbosity"},
|
||||
LogLevel::LNOTICE};
|
||||
|
||||
class FileLogListener : public LogListener
|
||||
{
|
||||
|
@ -42,7 +43,7 @@ public:
|
|||
SetEnable(true);
|
||||
}
|
||||
|
||||
void Log(LOG_LEVELS, const char* msg) override
|
||||
void Log(LogLevel, const char* msg) override
|
||||
{
|
||||
if (!IsEnabled() || !IsValid())
|
||||
return;
|
||||
|
@ -61,7 +62,7 @@ private:
|
|||
bool m_enable;
|
||||
};
|
||||
|
||||
void GenericLog(LOG_LEVELS level, LOG_TYPE type, const char* file, int line, const char* fmt, ...)
|
||||
void GenericLog(LogLevel level, LogType type, const char* file, int line, const char* fmt, ...)
|
||||
{
|
||||
auto* instance = LogManager::GetInstance();
|
||||
if (instance == nullptr)
|
||||
|
@ -79,7 +80,7 @@ void GenericLog(LOG_LEVELS level, LOG_TYPE type, const char* file, int line, con
|
|||
instance->Log(level, type, file, line, message);
|
||||
}
|
||||
|
||||
void GenericLogFmtImpl(LOG_LEVELS level, LOG_TYPE type, const char* file, int line,
|
||||
void GenericLogFmtImpl(LogLevel level, LogType type, const char* file, int line,
|
||||
fmt::string_view format, const fmt::format_args& args)
|
||||
{
|
||||
auto* instance = LogManager::GetInstance();
|
||||
|
@ -115,79 +116,75 @@ static size_t DeterminePathCutOffPoint()
|
|||
LogManager::LogManager()
|
||||
{
|
||||
// create log containers
|
||||
m_log[ACTIONREPLAY] = {"ActionReplay", "Action Replay"};
|
||||
m_log[AUDIO] = {"Audio", "Audio Emulator"};
|
||||
m_log[AUDIO_INTERFACE] = {"AI", "Audio Interface"};
|
||||
m_log[BOOT] = {"BOOT", "Boot"};
|
||||
m_log[COMMANDPROCESSOR] = {"CP", "Command Processor"};
|
||||
m_log[COMMON] = {"COMMON", "Common"};
|
||||
m_log[CONSOLE] = {"CONSOLE", "Dolphin Console"};
|
||||
m_log[CONTROLLERINTERFACE] = {"CI", "Controller Interface"};
|
||||
m_log[CORE] = {"CORE", "Core"};
|
||||
m_log[DISCIO] = {"DIO", "Disc IO"};
|
||||
m_log[DSPHLE] = {"DSPHLE", "DSP HLE"};
|
||||
m_log[DSPLLE] = {"DSPLLE", "DSP LLE"};
|
||||
m_log[DSP_MAIL] = {"DSPMails", "DSP Mails"};
|
||||
m_log[DSPINTERFACE] = {"DSP", "DSP Interface"};
|
||||
m_log[DVDINTERFACE] = {"DVD", "DVD Interface"};
|
||||
m_log[DYNA_REC] = {"JIT", "JIT Dynamic Recompiler"};
|
||||
m_log[EXPANSIONINTERFACE] = {"EXI", "Expansion Interface"};
|
||||
m_log[FILEMON] = {"FileMon", "File Monitor"};
|
||||
m_log[FRAMEDUMP] = {"FRAMEDUMP", "FrameDump"};
|
||||
m_log[GDB_STUB] = {"GDB_STUB", "GDB Stub"};
|
||||
m_log[GPFIFO] = {"GP", "GatherPipe FIFO"};
|
||||
m_log[HOST_GPU] = {"Host GPU", "Host GPU"};
|
||||
m_log[IOS] = {"IOS", "IOS"};
|
||||
m_log[IOS_DI] = {"IOS_DI", "IOS - Drive Interface"};
|
||||
m_log[IOS_ES] = {"IOS_ES", "IOS - ETicket Services"};
|
||||
m_log[IOS_FS] = {"IOS_FS", "IOS - Filesystem Services"};
|
||||
m_log[IOS_SD] = {"IOS_SD", "IOS - SDIO"};
|
||||
m_log[IOS_SSL] = {"IOS_SSL", "IOS - SSL"};
|
||||
m_log[IOS_STM] = {"IOS_STM", "IOS - State Transition Manager"};
|
||||
m_log[IOS_NET] = {"IOS_NET", "IOS - Network"};
|
||||
m_log[IOS_USB] = {"IOS_USB", "IOS - USB"};
|
||||
m_log[IOS_WC24] = {"IOS_WC24", "IOS - WiiConnect24"};
|
||||
m_log[IOS_WFS] = {"IOS_WFS", "IOS - WFS"};
|
||||
m_log[IOS_WIIMOTE] = {"IOS_WIIMOTE", "IOS - Wii Remote"};
|
||||
m_log[MASTER_LOG] = {"MASTER", "Master Log"};
|
||||
m_log[MEMCARD_MANAGER] = {"MemCard Manager", "Memory Card Manager"};
|
||||
m_log[MEMMAP] = {"MI", "Memory Interface & Memory Map"};
|
||||
m_log[NETPLAY] = {"NETPLAY", "Netplay"};
|
||||
m_log[OSHLE] = {"HLE", "OSHLE"};
|
||||
m_log[OSREPORT] = {"OSREPORT", "OSReport EXI"};
|
||||
m_log[OSREPORT_HLE] = {"OSREPORT_HLE", "OSReport HLE"};
|
||||
m_log[PIXELENGINE] = {"PE", "Pixel Engine"};
|
||||
m_log[PROCESSORINTERFACE] = {"PI", "Processor Interface"};
|
||||
m_log[POWERPC] = {"PowerPC", "PowerPC IBM CPU"};
|
||||
m_log[SERIALINTERFACE] = {"SI", "Serial Interface"};
|
||||
m_log[SP1] = {"SP1", "Serial Port 1"};
|
||||
m_log[SYMBOLS] = {"SYMBOLS", "Symbols"};
|
||||
m_log[VIDEO] = {"Video", "Video Backend"};
|
||||
m_log[VIDEOINTERFACE] = {"VI", "Video Interface"};
|
||||
m_log[WIIMOTE] = {"Wiimote", "Wii Remote"};
|
||||
m_log[WII_IPC] = {"WII_IPC", "WII IPC"};
|
||||
m_log[LogType::ACTIONREPLAY] = {"ActionReplay", "Action Replay"};
|
||||
m_log[LogType::AUDIO] = {"Audio", "Audio Emulator"};
|
||||
m_log[LogType::AUDIO_INTERFACE] = {"AI", "Audio Interface"};
|
||||
m_log[LogType::BOOT] = {"BOOT", "Boot"};
|
||||
m_log[LogType::COMMANDPROCESSOR] = {"CP", "Command Processor"};
|
||||
m_log[LogType::COMMON] = {"COMMON", "Common"};
|
||||
m_log[LogType::CONSOLE] = {"CONSOLE", "Dolphin Console"};
|
||||
m_log[LogType::CONTROLLERINTERFACE] = {"CI", "Controller Interface"};
|
||||
m_log[LogType::CORE] = {"CORE", "Core"};
|
||||
m_log[LogType::DISCIO] = {"DIO", "Disc IO"};
|
||||
m_log[LogType::DSPHLE] = {"DSPHLE", "DSP HLE"};
|
||||
m_log[LogType::DSPLLE] = {"DSPLLE", "DSP LLE"};
|
||||
m_log[LogType::DSP_MAIL] = {"DSPMails", "DSP Mails"};
|
||||
m_log[LogType::DSPINTERFACE] = {"DSP", "DSP Interface"};
|
||||
m_log[LogType::DVDINTERFACE] = {"DVD", "DVD Interface"};
|
||||
m_log[LogType::DYNA_REC] = {"JIT", "JIT Dynamic Recompiler"};
|
||||
m_log[LogType::EXPANSIONINTERFACE] = {"EXI", "Expansion Interface"};
|
||||
m_log[LogType::FILEMON] = {"FileMon", "File Monitor"};
|
||||
m_log[LogType::FRAMEDUMP] = {"FRAMEDUMP", "FrameDump"};
|
||||
m_log[LogType::GDB_STUB] = {"GDB_STUB", "GDB Stub"};
|
||||
m_log[LogType::GPFIFO] = {"GP", "GatherPipe FIFO"};
|
||||
m_log[LogType::HOST_GPU] = {"Host GPU", "Host GPU"};
|
||||
m_log[LogType::IOS] = {"IOS", "IOS"};
|
||||
m_log[LogType::IOS_DI] = {"IOS_DI", "IOS - Drive Interface"};
|
||||
m_log[LogType::IOS_ES] = {"IOS_ES", "IOS - ETicket Services"};
|
||||
m_log[LogType::IOS_FS] = {"IOS_FS", "IOS - Filesystem Services"};
|
||||
m_log[LogType::IOS_SD] = {"IOS_SD", "IOS - SDIO"};
|
||||
m_log[LogType::IOS_SSL] = {"IOS_SSL", "IOS - SSL"};
|
||||
m_log[LogType::IOS_STM] = {"IOS_STM", "IOS - State Transition Manager"};
|
||||
m_log[LogType::IOS_NET] = {"IOS_NET", "IOS - Network"};
|
||||
m_log[LogType::IOS_USB] = {"IOS_USB", "IOS - USB"};
|
||||
m_log[LogType::IOS_WC24] = {"IOS_WC24", "IOS - WiiConnect24"};
|
||||
m_log[LogType::IOS_WFS] = {"IOS_WFS", "IOS - WFS"};
|
||||
m_log[LogType::IOS_WIIMOTE] = {"IOS_WIIMOTE", "IOS - Wii Remote"};
|
||||
m_log[LogType::MASTER_LOG] = {"MASTER", "Master Log"};
|
||||
m_log[LogType::MEMCARD_MANAGER] = {"MemCard Manager", "Memory Card Manager"};
|
||||
m_log[LogType::MEMMAP] = {"MI", "Memory Interface & Memory Map"};
|
||||
m_log[LogType::NETPLAY] = {"NETPLAY", "Netplay"};
|
||||
m_log[LogType::OSHLE] = {"HLE", "OSHLE"};
|
||||
m_log[LogType::OSREPORT] = {"OSREPORT", "OSReport EXI"};
|
||||
m_log[LogType::OSREPORT_HLE] = {"OSREPORT_HLE", "OSReport HLE"};
|
||||
m_log[LogType::PIXELENGINE] = {"PE", "Pixel Engine"};
|
||||
m_log[LogType::PROCESSORINTERFACE] = {"PI", "Processor Interface"};
|
||||
m_log[LogType::POWERPC] = {"PowerPC", "PowerPC IBM CPU"};
|
||||
m_log[LogType::SERIALINTERFACE] = {"SI", "Serial Interface"};
|
||||
m_log[LogType::SP1] = {"SP1", "Serial Port 1"};
|
||||
m_log[LogType::SYMBOLS] = {"SYMBOLS", "Symbols"};
|
||||
m_log[LogType::VIDEO] = {"Video", "Video Backend"};
|
||||
m_log[LogType::VIDEOINTERFACE] = {"VI", "Video Interface"};
|
||||
m_log[LogType::WIIMOTE] = {"Wiimote", "Wii Remote"};
|
||||
m_log[LogType::WII_IPC] = {"WII_IPC", "WII IPC"};
|
||||
|
||||
RegisterListener(LogListener::FILE_LISTENER,
|
||||
new FileLogListener(File::GetUserPath(F_MAINLOG_IDX)));
|
||||
RegisterListener(LogListener::CONSOLE_LISTENER, new ConsoleListener());
|
||||
|
||||
// Set up log listeners
|
||||
int verbosity = Config::Get(LOGGER_VERBOSITY);
|
||||
LogLevel verbosity = Config::Get(LOGGER_VERBOSITY);
|
||||
|
||||
// Ensure the verbosity level is valid
|
||||
if (verbosity < 1)
|
||||
verbosity = 1;
|
||||
if (verbosity > MAX_LOGLEVEL)
|
||||
verbosity = MAX_LOGLEVEL;
|
||||
|
||||
SetLogLevel(static_cast<LOG_LEVELS>(verbosity));
|
||||
SetLogLevel(verbosity);
|
||||
EnableListener(LogListener::FILE_LISTENER, Config::Get(LOGGER_WRITE_TO_FILE));
|
||||
EnableListener(LogListener::CONSOLE_LISTENER, Config::Get(LOGGER_WRITE_TO_CONSOLE));
|
||||
EnableListener(LogListener::LOG_WINDOW_LISTENER, Config::Get(LOGGER_WRITE_TO_WINDOW));
|
||||
|
||||
for (LogContainer& container : m_log)
|
||||
for (auto& container : m_log)
|
||||
{
|
||||
container.m_enable = Config::Get(
|
||||
Config::Info<bool>{{Config::System::Logger, "Logs", container.m_short_name}, false});
|
||||
}
|
||||
|
||||
m_path_cutoff_point = DeterminePathCutOffPoint();
|
||||
}
|
||||
|
@ -208,7 +205,7 @@ void LogManager::SaveSettings()
|
|||
IsListenerEnabled(LogListener::CONSOLE_LISTENER));
|
||||
Config::SetBaseOrCurrent(LOGGER_WRITE_TO_WINDOW,
|
||||
IsListenerEnabled(LogListener::LOG_WINDOW_LISTENER));
|
||||
Config::SetBaseOrCurrent(LOGGER_VERBOSITY, static_cast<int>(GetLogLevel()));
|
||||
Config::SetBaseOrCurrent(LOGGER_VERBOSITY, GetLogLevel());
|
||||
|
||||
for (const auto& container : m_log)
|
||||
{
|
||||
|
@ -219,8 +216,7 @@ void LogManager::SaveSettings()
|
|||
Config::Save();
|
||||
}
|
||||
|
||||
void LogManager::Log(LOG_LEVELS level, LOG_TYPE type, const char* file, int line,
|
||||
const char* message)
|
||||
void LogManager::Log(LogLevel level, LogType type, const char* file, int line, const char* message)
|
||||
{
|
||||
if (!IsEnabled(type, level) || !static_cast<bool>(m_listener_ids))
|
||||
return;
|
||||
|
@ -228,7 +224,7 @@ void LogManager::Log(LOG_LEVELS level, LOG_TYPE type, const char* file, int line
|
|||
LogWithFullPath(level, type, file + m_path_cutoff_point, line, message);
|
||||
}
|
||||
|
||||
void LogManager::LogWithFullPath(LOG_LEVELS level, LOG_TYPE type, const char* file, int line,
|
||||
void LogManager::LogWithFullPath(LogLevel level, LogType type, const char* file, int line,
|
||||
const char* message)
|
||||
{
|
||||
const std::string msg =
|
||||
|
@ -242,22 +238,22 @@ void LogManager::LogWithFullPath(LOG_LEVELS level, LOG_TYPE type, const char* fi
|
|||
}
|
||||
}
|
||||
|
||||
LOG_LEVELS LogManager::GetLogLevel() const
|
||||
LogLevel LogManager::GetLogLevel() const
|
||||
{
|
||||
return m_level;
|
||||
}
|
||||
|
||||
void LogManager::SetLogLevel(LOG_LEVELS level)
|
||||
void LogManager::SetLogLevel(LogLevel level)
|
||||
{
|
||||
m_level = level;
|
||||
m_level = std::clamp(level, LogLevel::LNOTICE, MAX_LOGLEVEL);
|
||||
}
|
||||
|
||||
void LogManager::SetEnable(LOG_TYPE type, bool enable)
|
||||
void LogManager::SetEnable(LogType type, bool enable)
|
||||
{
|
||||
m_log[type].m_enable = enable;
|
||||
}
|
||||
|
||||
bool LogManager::IsEnabled(LOG_TYPE type, LOG_LEVELS level) const
|
||||
bool LogManager::IsEnabled(LogType type, LogLevel level) const
|
||||
{
|
||||
return m_log[type].m_enable && GetLogLevel() >= level;
|
||||
}
|
||||
|
@ -267,18 +263,17 @@ std::map<std::string, std::string> LogManager::GetLogTypes()
|
|||
std::map<std::string, std::string> log_types;
|
||||
|
||||
for (const auto& container : m_log)
|
||||
{
|
||||
log_types.emplace(container.m_short_name, container.m_full_name);
|
||||
}
|
||||
|
||||
return log_types;
|
||||
}
|
||||
|
||||
const char* LogManager::GetShortName(LOG_TYPE type) const
|
||||
const char* LogManager::GetShortName(LogType type) const
|
||||
{
|
||||
return m_log[type].m_short_name;
|
||||
}
|
||||
|
||||
const char* LogManager::GetFullName(LOG_TYPE type) const
|
||||
const char* LogManager::GetFullName(LogType type) const
|
||||
{
|
||||
return m_log[type].m_full_name;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "Common/BitSet.h"
|
||||
#include "Common/EnumMap.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
|
||||
namespace Common::Log
|
||||
|
@ -18,7 +19,7 @@ class LogListener
|
|||
{
|
||||
public:
|
||||
virtual ~LogListener() = default;
|
||||
virtual void Log(LOG_LEVELS level, const char* msg) = 0;
|
||||
virtual void Log(LogLevel level, const char* msg) = 0;
|
||||
|
||||
enum LISTENER
|
||||
{
|
||||
|
@ -37,18 +38,18 @@ public:
|
|||
static void Init();
|
||||
static void Shutdown();
|
||||
|
||||
void Log(LOG_LEVELS level, LOG_TYPE type, const char* file, int line, const char* message);
|
||||
void Log(LogLevel level, LogType type, const char* file, int line, const char* message);
|
||||
|
||||
LOG_LEVELS GetLogLevel() const;
|
||||
void SetLogLevel(LOG_LEVELS level);
|
||||
LogLevel GetLogLevel() const;
|
||||
void SetLogLevel(LogLevel level);
|
||||
|
||||
void SetEnable(LOG_TYPE type, bool enable);
|
||||
bool IsEnabled(LOG_TYPE type, LOG_LEVELS level = LNOTICE) const;
|
||||
void SetEnable(LogType type, bool enable);
|
||||
bool IsEnabled(LogType type, LogLevel level = LogLevel::LNOTICE) const;
|
||||
|
||||
std::map<std::string, std::string> GetLogTypes();
|
||||
|
||||
const char* GetShortName(LOG_TYPE type) const;
|
||||
const char* GetFullName(LOG_TYPE type) const;
|
||||
const char* GetShortName(LogType type) const;
|
||||
const char* GetFullName(LogType type) const;
|
||||
|
||||
void RegisterListener(LogListener::LISTENER id, LogListener* listener);
|
||||
void EnableListener(LogListener::LISTENER id, bool enable);
|
||||
|
@ -72,11 +73,11 @@ private:
|
|||
LogManager(LogManager&&) = delete;
|
||||
LogManager& operator=(LogManager&&) = delete;
|
||||
|
||||
void LogWithFullPath(LOG_LEVELS level, LOG_TYPE type, const char* file, int line,
|
||||
void LogWithFullPath(LogLevel level, LogType type, const char* file, int line,
|
||||
const char* message);
|
||||
|
||||
LOG_LEVELS m_level;
|
||||
std::array<LogContainer, NUMBER_OF_LOGS> m_log{};
|
||||
LogLevel m_level;
|
||||
EnumMap<LogContainer, LogType::WIIMOTE> m_log{};
|
||||
std::array<LogListener*, LogListener::NUMBER_OF_LISTENERS> m_listeners{};
|
||||
BitSet32 m_listener_ids;
|
||||
size_t m_path_cutoff_point = 0;
|
||||
|
|
|
@ -315,7 +315,7 @@ static void VLogInfo(std::string_view format, fmt::format_args args)
|
|||
return;
|
||||
|
||||
const bool use_internal_log = s_use_internal_log.load(std::memory_order_relaxed);
|
||||
if (Common::Log::MAX_LOGLEVEL < Common::Log::LINFO && !use_internal_log)
|
||||
if (Common::Log::MAX_LOGLEVEL < Common::Log::LogLevel::LINFO && !use_internal_log)
|
||||
return;
|
||||
|
||||
std::string text = fmt::vformat(format, args);
|
||||
|
|
|
@ -97,7 +97,7 @@ bool GetCallstack(std::vector<CallstackEntry>& output)
|
|||
return true;
|
||||
}
|
||||
|
||||
void PrintCallstack(Common::Log::LOG_TYPE type, Common::Log::LOG_LEVELS level)
|
||||
void PrintCallstack(Common::Log::LogType type, Common::Log::LogLevel level)
|
||||
{
|
||||
GENERIC_LOG_FMT(type, level, "== STACK TRACE - SP = {:08x} ==", PowerPC::ppcState.gpr[1]);
|
||||
|
||||
|
@ -119,10 +119,9 @@ void PrintCallstack(Common::Log::LOG_TYPE type, Common::Log::LOG_LEVELS level)
|
|||
});
|
||||
}
|
||||
|
||||
void PrintDataBuffer(Common::Log::LOG_TYPE type, const u8* data, size_t size,
|
||||
std::string_view title)
|
||||
void PrintDataBuffer(Common::Log::LogType type, const u8* data, size_t size, std::string_view title)
|
||||
{
|
||||
GENERIC_LOG_FMT(type, Common::Log::LDEBUG, "{}", title);
|
||||
GENERIC_LOG_FMT(type, Common::Log::LogLevel::LDEBUG, "{}", title);
|
||||
for (u32 j = 0; j < size;)
|
||||
{
|
||||
std::string hex_line;
|
||||
|
@ -133,7 +132,7 @@ void PrintDataBuffer(Common::Log::LOG_TYPE type, const u8* data, size_t size,
|
|||
if (j >= size)
|
||||
break;
|
||||
}
|
||||
GENERIC_LOG_FMT(type, Common::Log::LDEBUG, " Data: {}", hex_line);
|
||||
GENERIC_LOG_FMT(type, Common::Log::LogLevel::LDEBUG, " Data: {}", hex_line);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ struct CallstackEntry
|
|||
};
|
||||
|
||||
bool GetCallstack(std::vector<CallstackEntry>& output);
|
||||
void PrintCallstack(Common::Log::LOG_TYPE type, Common::Log::LOG_LEVELS level);
|
||||
void PrintDataBuffer(Common::Log::LOG_TYPE type, const u8* data, size_t size,
|
||||
void PrintCallstack(Common::Log::LogType type, Common::Log::LogLevel level);
|
||||
void PrintDataBuffer(Common::Log::LogType type, const u8* data, size_t size,
|
||||
std::string_view title);
|
||||
void AddAutoBreakpoints();
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ static bool IsSoundFile(const std::string& filename)
|
|||
void Log(const DiscIO::Volume& volume, const DiscIO::Partition& partition, u64 offset)
|
||||
{
|
||||
// Do nothing if the log isn't selected
|
||||
if (!Common::Log::LogManager::GetInstance()->IsEnabled(Common::Log::FILEMON,
|
||||
Common::Log::LWARNING))
|
||||
if (!Common::Log::LogManager::GetInstance()->IsEnabled(Common::Log::LogType::FILEMON,
|
||||
Common::Log::LogLevel::LWARNING))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -321,11 +321,11 @@ int CSIDevice_GBA::RunBuffer(u8* buffer, int request_length)
|
|||
if (num_data_received == 0)
|
||||
return -1;
|
||||
#ifdef _DEBUG
|
||||
const Common::Log::LOG_LEVELS log_level =
|
||||
const Common::Log::LogLevel log_level =
|
||||
(m_last_cmd == EBufferCommands::CMD_STATUS || m_last_cmd == EBufferCommands::CMD_RESET) ?
|
||||
Common::Log::LERROR :
|
||||
Common::Log::LWARNING;
|
||||
GENERIC_LOG_FMT(Common::Log::SERIALINTERFACE, log_level,
|
||||
Common::Log::LogLevel::LERROR :
|
||||
Common::Log::LogLevel::LWARNING;
|
||||
GENERIC_LOG_FMT(Common::Log::LogType::SERIALINTERFACE, log_level,
|
||||
"{} [< {:02x}{:02x}{:02x}{:02x}{:02x}] ({})",
|
||||
m_device_number, buffer[0], buffer[1], buffer[2], buffer[3], buffer[4],
|
||||
num_data_received);
|
||||
|
|
|
@ -91,11 +91,11 @@ int CSIDevice_GBAEmu::RunBuffer(u8* buffer, int request_length)
|
|||
std::copy(response.begin(), response.end(), buffer);
|
||||
|
||||
#ifdef _DEBUG
|
||||
const Common::Log::LOG_LEVELS log_level =
|
||||
const Common::Log::LogLevel log_level =
|
||||
(m_last_cmd == EBufferCommands::CMD_STATUS || m_last_cmd == EBufferCommands::CMD_RESET) ?
|
||||
Common::Log::LERROR :
|
||||
Common::Log::LWARNING;
|
||||
GENERIC_LOG_FMT(Common::Log::SERIALINTERFACE, log_level,
|
||||
Common::Log::LogLevel::LERROR :
|
||||
Common::Log::LogLevel::LWARNING;
|
||||
GENERIC_LOG_FMT(Common::Log::LogType::SERIALINTERFACE, log_level,
|
||||
"{} [< {:02x}{:02x}{:02x}{:02x}{:02x}] ({})",
|
||||
m_device_number, buffer[0], buffer[1], buffer[2], buffer[3], buffer[4],
|
||||
response.size());
|
||||
|
|
|
@ -705,17 +705,17 @@ std::optional<IPCReply> DIDevice::IOCtlV(const IOCtlVRequest& request)
|
|||
case DIIoctl::DVDLowGetNoDiscOpenPartitionParams:
|
||||
ERROR_LOG_FMT(IOS_DI, "DVDLowGetNoDiscOpenPartitionParams - dummied out");
|
||||
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DIFFERENT_PARTITION_COMMAND);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_DI);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_DI);
|
||||
break;
|
||||
case DIIoctl::DVDLowNoDiscOpenPartition:
|
||||
ERROR_LOG_FMT(IOS_DI, "DVDLowNoDiscOpenPartition - dummied out");
|
||||
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DIFFERENT_PARTITION_COMMAND);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_DI);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_DI);
|
||||
break;
|
||||
case DIIoctl::DVDLowGetNoDiscBufferSizes:
|
||||
ERROR_LOG_FMT(IOS_DI, "DVDLowGetNoDiscBufferSizes - dummied out");
|
||||
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DIFFERENT_PARTITION_COMMAND);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_DI);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_DI);
|
||||
break;
|
||||
case DIIoctl::DVDLowOpenPartitionWithTmdAndTicket:
|
||||
ERROR_LOG_FMT(IOS_DI, "DVDLowOpenPartitionWithTmdAndTicket - not implemented");
|
||||
|
@ -727,7 +727,7 @@ std::optional<IPCReply> DIDevice::IOCtlV(const IOCtlVRequest& request)
|
|||
break;
|
||||
default:
|
||||
ERROR_LOG_FMT(IOS_DI, "Unknown ioctlv {:#04x}", request.request);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_DI);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_DI);
|
||||
}
|
||||
return IPCReply{static_cast<s32>(return_value)};
|
||||
}
|
||||
|
|
|
@ -94,15 +94,15 @@ bool IOCtlVRequest::HasNumberOfValidVectors(const size_t in_count, const size_t
|
|||
std::all_of(io_vectors.begin(), io_vectors.end(), IsValidVector);
|
||||
}
|
||||
|
||||
void IOCtlRequest::Log(std::string_view device_name, Common::Log::LOG_TYPE type,
|
||||
Common::Log::LOG_LEVELS verbosity) const
|
||||
void IOCtlRequest::Log(std::string_view device_name, Common::Log::LogType type,
|
||||
Common::Log::LogLevel verbosity) const
|
||||
{
|
||||
GENERIC_LOG_FMT(type, verbosity, "{} (fd {}) - IOCtl {:#x} (in_size={:#x}, out_size={:#x})",
|
||||
device_name, fd, request, buffer_in_size, buffer_out_size);
|
||||
}
|
||||
|
||||
void IOCtlRequest::Dump(const std::string& description, Common::Log::LOG_TYPE type,
|
||||
Common::Log::LOG_LEVELS level) const
|
||||
void IOCtlRequest::Dump(const std::string& description, Common::Log::LogType type,
|
||||
Common::Log::LogLevel level) const
|
||||
{
|
||||
Log("===== " + description, type, level);
|
||||
GENERIC_LOG_FMT(type, level, "In buffer\n{}",
|
||||
|
@ -111,14 +111,14 @@ void IOCtlRequest::Dump(const std::string& description, Common::Log::LOG_TYPE ty
|
|||
HexDump(Memory::GetPointer(buffer_out), buffer_out_size));
|
||||
}
|
||||
|
||||
void IOCtlRequest::DumpUnknown(const std::string& description, Common::Log::LOG_TYPE type,
|
||||
Common::Log::LOG_LEVELS level) const
|
||||
void IOCtlRequest::DumpUnknown(const std::string& description, Common::Log::LogType type,
|
||||
Common::Log::LogLevel level) const
|
||||
{
|
||||
Dump("Unknown IOCtl - " + description, type, level);
|
||||
}
|
||||
|
||||
void IOCtlVRequest::Dump(std::string_view description, Common::Log::LOG_TYPE type,
|
||||
Common::Log::LOG_LEVELS level) const
|
||||
void IOCtlVRequest::Dump(std::string_view description, Common::Log::LogType type,
|
||||
Common::Log::LogLevel level) const
|
||||
{
|
||||
GENERIC_LOG_FMT(type, level, "===== {} (fd {}) - IOCtlV {:#x} ({} in, {} io)", description, fd,
|
||||
request, in_vectors.size(), io_vectors.size());
|
||||
|
@ -135,8 +135,8 @@ void IOCtlVRequest::Dump(std::string_view description, Common::Log::LOG_TYPE typ
|
|||
GENERIC_LOG_FMT(type, level, "io[{}] (size={:#x})", i++, vector.size);
|
||||
}
|
||||
|
||||
void IOCtlVRequest::DumpUnknown(const std::string& description, Common::Log::LOG_TYPE type,
|
||||
Common::Log::LOG_LEVELS level) const
|
||||
void IOCtlVRequest::DumpUnknown(const std::string& description, Common::Log::LogType type,
|
||||
Common::Log::LogLevel level) const
|
||||
{
|
||||
Dump("Unknown IOCtlV - " + description, type, level);
|
||||
}
|
||||
|
|
|
@ -130,12 +130,13 @@ struct IOCtlRequest final : Request
|
|||
u32 buffer_out = 0;
|
||||
u32 buffer_out_size = 0;
|
||||
explicit IOCtlRequest(u32 address);
|
||||
void Log(std::string_view description, Common::Log::LOG_TYPE type = Common::Log::IOS,
|
||||
Common::Log::LOG_LEVELS level = Common::Log::LINFO) const;
|
||||
void Dump(const std::string& description, Common::Log::LOG_TYPE type = Common::Log::IOS,
|
||||
Common::Log::LOG_LEVELS level = Common::Log::LINFO) const;
|
||||
void DumpUnknown(const std::string& description, Common::Log::LOG_TYPE type = Common::Log::IOS,
|
||||
Common::Log::LOG_LEVELS level = Common::Log::LERROR) const;
|
||||
void Log(std::string_view description, Common::Log::LogType type = Common::Log::LogType::IOS,
|
||||
Common::Log::LogLevel level = Common::Log::LogLevel::LINFO) const;
|
||||
void Dump(const std::string& description, Common::Log::LogType type = Common::Log::LogType::IOS,
|
||||
Common::Log::LogLevel level = Common::Log::LogLevel::LINFO) const;
|
||||
void DumpUnknown(const std::string& description,
|
||||
Common::Log::LogType type = Common::Log::LogType::IOS,
|
||||
Common::Log::LogLevel level = Common::Log::LogLevel::LERROR) const;
|
||||
};
|
||||
|
||||
struct IOCtlVRequest final : Request
|
||||
|
@ -160,10 +161,11 @@ struct IOCtlVRequest final : Request
|
|||
|
||||
explicit IOCtlVRequest(u32 address);
|
||||
bool HasNumberOfValidVectors(size_t in_count, size_t io_count) const;
|
||||
void Dump(std::string_view description, Common::Log::LOG_TYPE type = Common::Log::IOS,
|
||||
Common::Log::LOG_LEVELS level = Common::Log::LINFO) const;
|
||||
void DumpUnknown(const std::string& description, Common::Log::LOG_TYPE type = Common::Log::IOS,
|
||||
Common::Log::LOG_LEVELS level = Common::Log::LERROR) const;
|
||||
void Dump(std::string_view description, Common::Log::LogType type = Common::Log::LogType::IOS,
|
||||
Common::Log::LogLevel level = Common::Log::LogLevel::LINFO) const;
|
||||
void DumpUnknown(const std::string& description,
|
||||
Common::Log::LogType type = Common::Log::LogType::IOS,
|
||||
Common::Log::LogLevel level = Common::Log::LogLevel::LERROR) const;
|
||||
};
|
||||
|
||||
class Device
|
||||
|
|
|
@ -680,7 +680,8 @@ std::optional<IPCReply> ESDevice::IOCtlV(const IOCtlVRequest& request)
|
|||
case IOCTL_ES_UNKNOWN_42:
|
||||
PanicAlertFmt("IOS-ES: Unimplemented ioctlv {:#x} ({} in vectors, {} io vectors)",
|
||||
request.request, request.in_vectors.size(), request.io_vectors.size());
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_ES, Common::Log::LERROR);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_ES,
|
||||
Common::Log::LogLevel::LERROR);
|
||||
return IPCReply(IPC_EINVAL);
|
||||
|
||||
case IOCTL_ES_INVALID_3F:
|
||||
|
|
|
@ -104,9 +104,10 @@ template <typename... Args>
|
|||
static void LogResult(ResultCode code, std::string_view format, Args&&... args)
|
||||
{
|
||||
const std::string command = fmt::format(format, std::forward<Args>(args)...);
|
||||
const auto type = code == ResultCode::Success ? Common::Log::LINFO : Common::Log::LERROR;
|
||||
const auto type =
|
||||
code == ResultCode::Success ? Common::Log::LogLevel::LINFO : Common::Log::LogLevel::LERROR;
|
||||
|
||||
GENERIC_LOG_FMT(Common::Log::IOS_FS, type, "Command: {}: Result {}", command,
|
||||
GENERIC_LOG_FMT(Common::Log::LogType::IOS_FS, type, "Command: {}: Result {}", command,
|
||||
ConvertResult(code));
|
||||
}
|
||||
|
||||
|
|
|
@ -330,7 +330,7 @@ std::optional<IPCReply> NetIPTopDevice::IOCtl(const IOCtlRequest& request)
|
|||
case IOCTL_SO_ICMPCANCEL:
|
||||
return HandleICMPCancelRequest(request);
|
||||
default:
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_NET);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_NET);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ std::optional<IPCReply> NetIPTopDevice::IOCtlV(const IOCtlVRequest& request)
|
|||
case IOCTLV_SO_ICMPPING:
|
||||
return HandleICMPPingRequest(request);
|
||||
default:
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_NET);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_NET);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -375,7 +375,7 @@ void NetIPTopDevice::Update()
|
|||
|
||||
IPCReply NetIPTopDevice::HandleInitInterfaceRequest(const IOCtlRequest& request)
|
||||
{
|
||||
request.Log(GetDeviceName(), Common::Log::IOS_WC24);
|
||||
request.Log(GetDeviceName(), Common::Log::LogType::IOS_WC24);
|
||||
return IPCReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,7 @@ IPCReply NetIPTopDevice::HandleListenRequest(const IOCtlRequest& request)
|
|||
u32 BACKLOG = Memory::Read_U32(request.buffer_in + 0x04);
|
||||
u32 ret = listen(WiiSockMan::GetInstance().GetHostSocket(fd), BACKLOG);
|
||||
|
||||
request.Log(GetDeviceName(), Common::Log::IOS_WC24);
|
||||
request.Log(GetDeviceName(), Common::Log::LogType::IOS_WC24);
|
||||
return IPCReply(WiiSockMan::GetNetErrorCode(ret, "SO_LISTEN", false));
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ IPCReply NetIPTopDevice::HandleGetSockOptRequest(const IOCtlRequest& request)
|
|||
u32 level = Memory::Read_U32(request.buffer_out + 4);
|
||||
u32 optname = Memory::Read_U32(request.buffer_out + 8);
|
||||
|
||||
request.Log(GetDeviceName(), Common::Log::IOS_WC24);
|
||||
request.Log(GetDeviceName(), Common::Log::LogType::IOS_WC24);
|
||||
|
||||
// Do the level/optname translation
|
||||
int nat_level = MapWiiSockOptLevelToNative(level);
|
||||
|
@ -527,7 +527,7 @@ IPCReply NetIPTopDevice::HandleGetSockNameRequest(const IOCtlRequest& request)
|
|||
{
|
||||
u32 fd = Memory::Read_U32(request.buffer_in);
|
||||
|
||||
request.Log(GetDeviceName(), Common::Log::IOS_WC24);
|
||||
request.Log(GetDeviceName(), Common::Log::LogType::IOS_WC24);
|
||||
|
||||
sockaddr sa;
|
||||
socklen_t sa_len = sizeof(sa);
|
||||
|
@ -1047,7 +1047,7 @@ IPCReply NetIPTopDevice::HandleGetAddressInfoRequest(const IOCtlVRequest& reques
|
|||
ret = SO_ERROR_HOST_NOT_FOUND;
|
||||
}
|
||||
|
||||
request.Dump(GetDeviceName(), Common::Log::IOS_NET, Common::Log::LINFO);
|
||||
request.Dump(GetDeviceName(), Common::Log::LogType::IOS_NET, Common::Log::LogLevel::LINFO);
|
||||
return IPCReply(ret);
|
||||
}
|
||||
|
||||
|
|
|
@ -314,7 +314,7 @@ std::optional<IPCReply> NetKDRequestDevice::IOCtl(const IOCtlRequest& request)
|
|||
}
|
||||
|
||||
default:
|
||||
request.Log(GetDeviceName(), Common::Log::IOS_WC24);
|
||||
request.Log(GetDeviceName(), Common::Log::LogType::IOS_WC24);
|
||||
}
|
||||
|
||||
return IPCReply(return_value);
|
||||
|
|
|
@ -74,7 +74,7 @@ std::optional<IPCReply> NetKDTimeDevice::IOCtl(const IOCtlRequest& request)
|
|||
break;
|
||||
|
||||
default:
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_WC24);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_WC24);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ int NetSSLDevice::GetSSLFreeID() const
|
|||
|
||||
std::optional<IPCReply> NetSSLDevice::IOCtl(const IOCtlRequest& request)
|
||||
{
|
||||
request.Log(GetDeviceName(), Common::Log::IOS_SSL, Common::Log::LINFO);
|
||||
request.Log(GetDeviceName(), Common::Log::LogType::IOS_SSL, Common::Log::LogLevel::LINFO);
|
||||
return IPCReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -609,7 +609,7 @@ std::optional<IPCReply> NetSSLDevice::IOCtlV(const IOCtlVRequest& request)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_SSL);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_SSL);
|
||||
}
|
||||
|
||||
// SSL return codes are written to BufferIn
|
||||
|
|
|
@ -322,7 +322,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
|||
|
||||
ReturnValue = WiiSockMan::GetInstance().AddSocket(ret, true);
|
||||
|
||||
ioctl.Log("IOCTL_SO_ACCEPT", Common::Log::IOS_NET);
|
||||
ioctl.Log("IOCTL_SO_ACCEPT", Common::Log::LogType::IOS_NET);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -378,7 +378,7 @@ std::optional<IPCReply> NetWDCommandDevice::IOCtlV(const IOCtlVRequest& request)
|
|||
case IOCTLV_WD_CHANGE_VTSF:
|
||||
default:
|
||||
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_WD_UNIMPLEMENTED_IOCTL);
|
||||
request.Dump(GetDeviceName(), Common::Log::IOS_NET, Common::Log::LWARNING);
|
||||
request.Dump(GetDeviceName(), Common::Log::LogType::IOS_NET, Common::Log::LogLevel::LWARNING);
|
||||
}
|
||||
|
||||
return IPCReply(IPC_SUCCESS);
|
||||
|
|
|
@ -55,7 +55,7 @@ std::optional<IPCReply> STMImmediateDevice::IOCtl(const IOCtlRequest& request)
|
|||
break;
|
||||
|
||||
default:
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_STM);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_STM);
|
||||
}
|
||||
|
||||
return IPCReply(return_value);
|
||||
|
|
|
@ -200,7 +200,7 @@ std::optional<IPCReply> BluetoothEmuDevice::IOCtlV(const IOCtlVRequest& request)
|
|||
}
|
||||
|
||||
default:
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_WIIMOTE);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_WIIMOTE);
|
||||
}
|
||||
|
||||
if (!send_reply)
|
||||
|
@ -1710,7 +1710,7 @@ void BluetoothEmuDevice::CommandVendorSpecific_FC4F(const u8* input, u32 size)
|
|||
INFO_LOG_FMT(IOS_WIIMOTE, "Command: CommandVendorSpecific_FC4F: (callstack WUDiRemovePatch)");
|
||||
DEBUG_LOG_FMT(IOS_WIIMOTE, "Input (size {:#x}):", size);
|
||||
|
||||
Dolphin_Debugger::PrintDataBuffer(Common::Log::IOS_WIIMOTE, input, size, "Data: ");
|
||||
Dolphin_Debugger::PrintDataBuffer(Common::Log::LogType::IOS_WIIMOTE, input, size, "Data: ");
|
||||
|
||||
SendEventCommandComplete(0xFC4F, &reply, sizeof(hci_status_rp));
|
||||
}
|
||||
|
@ -1722,7 +1722,7 @@ void BluetoothEmuDevice::CommandVendorSpecific_FC4C(const u8* input, u32 size)
|
|||
|
||||
DEBUG_LOG_FMT(IOS_WIIMOTE, "Command: CommandVendorSpecific_FC4C:");
|
||||
DEBUG_LOG_FMT(IOS_WIIMOTE, "Input (size {:#x}):", size);
|
||||
Dolphin_Debugger::PrintDataBuffer(Common::Log::IOS_WIIMOTE, input, size, "Data: ");
|
||||
Dolphin_Debugger::PrintDataBuffer(Common::Log::LogType::IOS_WIIMOTE, input, size, "Data: ");
|
||||
|
||||
SendEventCommandComplete(0xFC4C, &reply, sizeof(hci_status_rp));
|
||||
}
|
||||
|
|
|
@ -799,16 +799,12 @@ static int ParseAttribList(u8* attrib_id_list, u16& start_id, u16& end_id)
|
|||
|
||||
const u8 sequence = attrib_list.Read8(attrib_offset);
|
||||
attrib_offset++;
|
||||
const u8 seq_size = attrib_list.Read8(attrib_offset);
|
||||
[[maybe_unused]] const u8 seq_size = attrib_list.Read8(attrib_offset);
|
||||
attrib_offset++;
|
||||
const u8 type_id = attrib_list.Read8(attrib_offset);
|
||||
attrib_offset++;
|
||||
|
||||
if constexpr (Common::Log::MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG)
|
||||
{
|
||||
DEBUG_ASSERT(sequence == SDP_SEQ8);
|
||||
(void)seq_size;
|
||||
}
|
||||
DEBUG_ASSERT(sequence == SDP_SEQ8);
|
||||
|
||||
if (type_id == SDP_UINT32)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ std::optional<IPCReply> OH0::Open(const OpenRequest& request)
|
|||
|
||||
std::optional<IPCReply> OH0::IOCtl(const IOCtlRequest& request)
|
||||
{
|
||||
request.Log(GetDeviceName(), Common::Log::IOS_USB);
|
||||
request.Log(GetDeviceName(), Common::Log::LogType::IOS_USB);
|
||||
switch (request.request)
|
||||
{
|
||||
case USB::IOCTL_USBV0_GETRHDESCA:
|
||||
|
@ -135,7 +135,7 @@ IPCReply OH0::GetRhDesca(const IOCtlRequest& request) const
|
|||
|
||||
// Based on a hardware test, this ioctl seems to return a constant value
|
||||
Memory::Write_U32(0x02000302, request.buffer_out);
|
||||
request.Dump(GetDeviceName(), Common::Log::IOS_USB, Common::Log::LWARNING);
|
||||
request.Dump(GetDeviceName(), Common::Log::LogType::IOS_USB, Common::Log::LogLevel::LWARNING);
|
||||
return IPCReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ IPCReply OH0::GetRhPortStatus(const IOCtlVRequest& request) const
|
|||
return IPCReply(IPC_EINVAL);
|
||||
|
||||
ERROR_LOG_FMT(IOS_USB, "Unimplemented IOCtlV: IOCTLV_USBV0_GETRHPORTSTATUS");
|
||||
request.Dump(GetDeviceName(), Common::Log::IOS_USB, Common::Log::LERROR);
|
||||
request.Dump(GetDeviceName(), Common::Log::LogType::IOS_USB, Common::Log::LogLevel::LERROR);
|
||||
return IPCReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ IPCReply OH0::SetRhPortStatus(const IOCtlVRequest& request)
|
|||
return IPCReply(IPC_EINVAL);
|
||||
|
||||
ERROR_LOG_FMT(IOS_USB, "Unimplemented IOCtlV: IOCTLV_USBV0_SETRHPORTSTATUS");
|
||||
request.Dump(GetDeviceName(), Common::Log::IOS_USB, Common::Log::LERROR);
|
||||
request.Dump(GetDeviceName(), Common::Log::LogType::IOS_USB, Common::Log::LogLevel::LERROR);
|
||||
return IPCReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ std::optional<IPCReply> OH0::RegisterClassChangeHook(const IOCtlVRequest& reques
|
|||
if (!request.HasNumberOfValidVectors(1, 0))
|
||||
return IPCReply(IPC_EINVAL);
|
||||
WARN_LOG_FMT(IOS_USB, "Unimplemented IOCtlV: USB::IOCTLV_USBV0_DEVICECLASSCHANGE (no reply)");
|
||||
request.Dump(GetDeviceName(), Common::Log::IOS_USB, Common::Log::LWARNING);
|
||||
request.Dump(GetDeviceName(), Common::Log::LogType::IOS_USB, Common::Log::LogLevel::LWARNING);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ std::optional<IPCReply> OH0::DeviceIOCtlV(const u64 device_id, const IOCtlVReque
|
|||
return HandleTransfer(device, request.request,
|
||||
[&, this]() { return SubmitTransfer(*device, request); });
|
||||
case USB::IOCTLV_USBV0_UNKNOWN_32:
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_USB);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_USB);
|
||||
return IPCReply(IPC_SUCCESS);
|
||||
default:
|
||||
return IPCReply(IPC_EINVAL);
|
||||
|
|
|
@ -32,7 +32,7 @@ USB_HIDv4::~USB_HIDv4()
|
|||
|
||||
std::optional<IPCReply> USB_HIDv4::IOCtl(const IOCtlRequest& request)
|
||||
{
|
||||
request.Log(GetDeviceName(), Common::Log::IOS_USB);
|
||||
request.Log(GetDeviceName(), Common::Log::LogType::IOS_USB);
|
||||
switch (request.request)
|
||||
{
|
||||
case USB::IOCTL_USBV4_GETVERSION:
|
||||
|
@ -60,7 +60,7 @@ std::optional<IPCReply> USB_HIDv4::IOCtl(const IOCtlRequest& request)
|
|||
[&, this]() { return SubmitTransfer(*device, request); });
|
||||
}
|
||||
default:
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_USB);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_USB);
|
||||
return IPCReply(IPC_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ USB_HIDv5::~USB_HIDv5()
|
|||
|
||||
std::optional<IPCReply> USB_HIDv5::IOCtl(const IOCtlRequest& request)
|
||||
{
|
||||
request.Log(GetDeviceName(), Common::Log::IOS_USB);
|
||||
request.Log(GetDeviceName(), Common::Log::LogType::IOS_USB);
|
||||
switch (request.request)
|
||||
{
|
||||
case USB::IOCTL_USBV5_GETVERSION:
|
||||
|
@ -46,14 +46,15 @@ std::optional<IPCReply> USB_HIDv5::IOCtl(const IOCtlRequest& request)
|
|||
return HandleDeviceIOCtl(request,
|
||||
[&](USBV5Device& device) { return CancelEndpoint(device, request); });
|
||||
default:
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_USB, Common::Log::LERROR);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_USB,
|
||||
Common::Log::LogLevel::LERROR);
|
||||
return IPCReply(IPC_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<IPCReply> USB_HIDv5::IOCtlV(const IOCtlVRequest& request)
|
||||
{
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_USB);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_USB);
|
||||
switch (request.request)
|
||||
{
|
||||
// TODO: HIDv5 seems to be able to queue transfers depending on the transfer length (unlike VEN).
|
||||
|
|
|
@ -24,7 +24,7 @@ USB_VEN::~USB_VEN()
|
|||
|
||||
std::optional<IPCReply> USB_VEN::IOCtl(const IOCtlRequest& request)
|
||||
{
|
||||
request.Log(GetDeviceName(), Common::Log::IOS_USB);
|
||||
request.Log(GetDeviceName(), Common::Log::LogType::IOS_USB);
|
||||
switch (request.request)
|
||||
{
|
||||
case USB::IOCTL_USBV5_GETVERSION:
|
||||
|
@ -49,7 +49,8 @@ std::optional<IPCReply> USB_VEN::IOCtl(const IOCtlRequest& request)
|
|||
return HandleDeviceIOCtl(request,
|
||||
[&](USBV5Device& device) { return CancelEndpoint(device, request); });
|
||||
default:
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_USB, Common::Log::LERROR);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_USB,
|
||||
Common::Log::LogLevel::LERROR);
|
||||
return IPCReply(IPC_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -540,7 +540,8 @@ std::optional<IPCReply> WFSIDevice::IOCtl(const IOCtlRequest& request)
|
|||
// TODO(wfs): Should be returning an error. However until we have
|
||||
// everything properly stubbed it's easier to simulate the methods
|
||||
// succeeding.
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS, Common::Log::LWARNING);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_WFS,
|
||||
Common::Log::LogLevel::LWARNING);
|
||||
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -353,7 +353,8 @@ std::optional<IPCReply> WFSSRVDevice::IOCtl(const IOCtlRequest& request)
|
|||
default:
|
||||
// TODO(wfs): Should be returning -3. However until we have everything
|
||||
// properly stubbed it's easier to simulate the methods succeeding.
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::IOS, Common::Log::LWARNING);
|
||||
request.DumpUnknown(GetDeviceName(), Common::Log::LogType::IOS_WFS,
|
||||
Common::Log::LogLevel::LWARNING);
|
||||
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -329,7 +329,7 @@ void Interpreter::unknown_instruction(UGeckoInstruction inst)
|
|||
const u32 opcode = PowerPC::HostRead_U32(last_pc);
|
||||
const std::string disasm = Common::GekkoDisassembler::Disassemble(opcode, last_pc);
|
||||
NOTICE_LOG_FMT(POWERPC, "Last PC = {:08x} : {}", last_pc, disasm);
|
||||
Dolphin_Debugger::PrintCallstack(Common::Log::POWERPC, Common::Log::LNOTICE);
|
||||
Dolphin_Debugger::PrintCallstack(Common::Log::LogType::POWERPC, Common::Log::LogLevel::LNOTICE);
|
||||
NOTICE_LOG_FMT(
|
||||
POWERPC,
|
||||
"\nIntCPU: Unknown instruction {:08x} at PC = {:08x} last_PC = {:08x} LR = {:08x}\n",
|
||||
|
|
|
@ -62,9 +62,9 @@ void LogConfigWidget::CreateWidgets()
|
|||
m_types_list = new QListWidget;
|
||||
|
||||
const auto* const log_manager = Common::Log::LogManager::GetInstance();
|
||||
for (int i = 0; i < Common::Log::NUMBER_OF_LOGS; i++)
|
||||
for (int i = 0; i < static_cast<int>(Common::Log::LogType::NUMBER_OF_LOGS); i++)
|
||||
{
|
||||
const auto log_type = static_cast<Common::Log::LOG_TYPE>(i);
|
||||
const auto log_type = static_cast<Common::Log::LogType>(i);
|
||||
const QString full_name = QString::fromUtf8(log_manager->GetFullName(log_type));
|
||||
const QString short_name = QString::fromUtf8(log_manager->GetShortName(log_type));
|
||||
auto* widget = new QListWidgetItem(QStringLiteral("%1 (%2)").arg(full_name, short_name));
|
||||
|
@ -77,7 +77,7 @@ void LogConfigWidget::CreateWidgets()
|
|||
verbosity_layout->addWidget(m_verbosity_error);
|
||||
verbosity_layout->addWidget(m_verbosity_warning);
|
||||
verbosity_layout->addWidget(m_verbosity_info);
|
||||
if constexpr (Common::Log::MAX_LOGLEVEL == Common::Log::LOG_LEVELS::LDEBUG)
|
||||
if constexpr (Common::Log::MAX_LOGLEVEL == Common::Log::LogLevel::LDEBUG)
|
||||
{
|
||||
verbosity_layout->addWidget(m_verbosity_debug);
|
||||
}
|
||||
|
@ -139,12 +139,12 @@ void LogConfigWidget::LoadSettings()
|
|||
setFloating(settings.value(QStringLiteral("logconfigwidget/floating")).toBool());
|
||||
|
||||
// Config - Verbosity
|
||||
const Common::Log::LOG_LEVELS verbosity = log_manager->GetLogLevel();
|
||||
m_verbosity_notice->setChecked(verbosity == Common::Log::LOG_LEVELS::LNOTICE);
|
||||
m_verbosity_error->setChecked(verbosity == Common::Log::LOG_LEVELS::LERROR);
|
||||
m_verbosity_warning->setChecked(verbosity == Common::Log::LOG_LEVELS::LWARNING);
|
||||
m_verbosity_info->setChecked(verbosity == Common::Log::LOG_LEVELS::LINFO);
|
||||
m_verbosity_debug->setChecked(verbosity == Common::Log::LOG_LEVELS::LDEBUG);
|
||||
const Common::Log::LogLevel verbosity = log_manager->GetLogLevel();
|
||||
m_verbosity_notice->setChecked(verbosity == Common::Log::LogLevel::LNOTICE);
|
||||
m_verbosity_error->setChecked(verbosity == Common::Log::LogLevel::LERROR);
|
||||
m_verbosity_warning->setChecked(verbosity == Common::Log::LogLevel::LWARNING);
|
||||
m_verbosity_info->setChecked(verbosity == Common::Log::LogLevel::LINFO);
|
||||
m_verbosity_debug->setChecked(verbosity == Common::Log::LogLevel::LDEBUG);
|
||||
|
||||
// Config - Outputs
|
||||
m_out_file->setChecked(log_manager->IsListenerEnabled(Common::Log::LogListener::FILE_LISTENER));
|
||||
|
@ -154,9 +154,9 @@ void LogConfigWidget::LoadSettings()
|
|||
log_manager->IsListenerEnabled(Common::Log::LogListener::LOG_WINDOW_LISTENER));
|
||||
|
||||
// Config - Log Types
|
||||
for (int i = 0; i < Common::Log::NUMBER_OF_LOGS; ++i)
|
||||
for (int i = 0; i < static_cast<int>(Common::Log::LogType::NUMBER_OF_LOGS); ++i)
|
||||
{
|
||||
const auto log_type = static_cast<Common::Log::LOG_TYPE>(i);
|
||||
const auto log_type = static_cast<Common::Log::LogType>(i);
|
||||
const bool log_enabled = log_manager->IsEnabled(log_type);
|
||||
|
||||
if (!log_enabled)
|
||||
|
@ -177,22 +177,22 @@ void LogConfigWidget::SaveSettings()
|
|||
settings.setValue(QStringLiteral("logconfigwidget/floating"), isFloating());
|
||||
|
||||
// Config - Verbosity
|
||||
auto verbosity = Common::Log::LOG_LEVELS::LNOTICE;
|
||||
auto verbosity = Common::Log::LogLevel::LNOTICE;
|
||||
|
||||
if (m_verbosity_notice->isChecked())
|
||||
verbosity = Common::Log::LOG_LEVELS::LNOTICE;
|
||||
verbosity = Common::Log::LogLevel::LNOTICE;
|
||||
|
||||
if (m_verbosity_error->isChecked())
|
||||
verbosity = Common::Log::LOG_LEVELS::LERROR;
|
||||
verbosity = Common::Log::LogLevel::LERROR;
|
||||
|
||||
if (m_verbosity_warning->isChecked())
|
||||
verbosity = Common::Log::LOG_LEVELS::LWARNING;
|
||||
verbosity = Common::Log::LogLevel::LWARNING;
|
||||
|
||||
if (m_verbosity_info->isChecked())
|
||||
verbosity = Common::Log::LOG_LEVELS::LINFO;
|
||||
verbosity = Common::Log::LogLevel::LINFO;
|
||||
|
||||
if (m_verbosity_debug->isChecked())
|
||||
verbosity = Common::Log::LOG_LEVELS::LDEBUG;
|
||||
verbosity = Common::Log::LogLevel::LDEBUG;
|
||||
|
||||
auto* const log_manager = Common::Log::LogManager::GetInstance();
|
||||
|
||||
|
@ -206,9 +206,9 @@ void LogConfigWidget::SaveSettings()
|
|||
log_manager->EnableListener(Common::Log::LogListener::LOG_WINDOW_LISTENER,
|
||||
m_out_window->isChecked());
|
||||
// Config - Log Types
|
||||
for (int i = 0; i < Common::Log::NUMBER_OF_LOGS; ++i)
|
||||
for (int i = 0; i < static_cast<int>(Common::Log::LogType::NUMBER_OF_LOGS); ++i)
|
||||
{
|
||||
const auto type = static_cast<Common::Log::LOG_TYPE>(i);
|
||||
const auto type = static_cast<Common::Log::LogType>(i);
|
||||
const bool enabled = m_types_list->item(i)->checkState() == Qt::Checked;
|
||||
const bool was_enabled = log_manager->IsEnabled(type);
|
||||
|
||||
|
|
|
@ -80,21 +80,21 @@ void LogWidget::UpdateLog()
|
|||
for (auto& line : elements_to_push)
|
||||
{
|
||||
const char* color = "white";
|
||||
switch (std::get<Common::Log::LOG_LEVELS>(line))
|
||||
switch (std::get<Common::Log::LogLevel>(line))
|
||||
{
|
||||
case Common::Log::LOG_LEVELS::LERROR:
|
||||
case Common::Log::LogLevel::LERROR:
|
||||
color = "red";
|
||||
break;
|
||||
case Common::Log::LOG_LEVELS::LWARNING:
|
||||
case Common::Log::LogLevel::LWARNING:
|
||||
color = "yellow";
|
||||
break;
|
||||
case Common::Log::LOG_LEVELS::LNOTICE:
|
||||
case Common::Log::LogLevel::LNOTICE:
|
||||
color = "lime";
|
||||
break;
|
||||
case Common::Log::LOG_LEVELS::LINFO:
|
||||
case Common::Log::LogLevel::LINFO:
|
||||
color = "cyan";
|
||||
break;
|
||||
case Common::Log::LOG_LEVELS::LDEBUG:
|
||||
case Common::Log::LogLevel::LDEBUG:
|
||||
color = "lightgrey";
|
||||
break;
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ void LogWidget::SaveSettings()
|
|||
UpdateFont();
|
||||
}
|
||||
|
||||
void LogWidget::Log(Common::Log::LOG_LEVELS level, const char* text)
|
||||
void LogWidget::Log(Common::Log::LogLevel level, const char* text)
|
||||
{
|
||||
size_t text_length = strlen(text);
|
||||
while (text_length > 0 && text[text_length - 1] == '\n')
|
||||
|
|
|
@ -36,7 +36,7 @@ private:
|
|||
void LoadSettings();
|
||||
void SaveSettings();
|
||||
|
||||
void Log(Common::Log::LOG_LEVELS level, const char* text) override;
|
||||
void Log(Common::Log::LogLevel level, const char* text) override;
|
||||
|
||||
// Log
|
||||
QCheckBox* m_log_wrap;
|
||||
|
@ -46,7 +46,7 @@ private:
|
|||
|
||||
QTimer* m_timer;
|
||||
|
||||
using LogEntry = std::pair<std::string, Common::Log::LOG_LEVELS>;
|
||||
using LogEntry = std::pair<std::string, Common::Log::LogLevel>;
|
||||
|
||||
// Maximum number of lines to show in log viewer
|
||||
static constexpr int MAX_LOG_LINES = 5000;
|
||||
|
|
|
@ -695,8 +695,8 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
|
|||
glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, true);
|
||||
glDebugMessageCallbackARB(ErrorCallback, nullptr);
|
||||
}
|
||||
if (Common::Log::LogManager::GetInstance()->IsEnabled(Common::Log::HOST_GPU,
|
||||
Common::Log::LERROR))
|
||||
if (Common::Log::LogManager::GetInstance()->IsEnabled(Common::Log::LogType::HOST_GPU,
|
||||
Common::Log::LogLevel::LERROR))
|
||||
{
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
}
|
||||
|
@ -1026,8 +1026,8 @@ void Renderer::PresentBackbuffer()
|
|||
{
|
||||
if (g_ogl_config.bSupportsDebug)
|
||||
{
|
||||
if (Common::Log::LogManager::GetInstance()->IsEnabled(Common::Log::HOST_GPU,
|
||||
Common::Log::LERROR))
|
||||
if (Common::Log::LogManager::GetInstance()->IsEnabled(Common::Log::LogType::HOST_GPU,
|
||||
Common::Log::LogLevel::LERROR))
|
||||
{
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ void VideoBackend::InitBackendInfo()
|
|||
// Helper method to check whether the Host GPU logging category is enabled.
|
||||
static bool IsHostGPULoggingEnabled()
|
||||
{
|
||||
return Common::Log::LogManager::GetInstance()->IsEnabled(Common::Log::HOST_GPU,
|
||||
Common::Log::LERROR);
|
||||
return Common::Log::LogManager::GetInstance()->IsEnabled(Common::Log::LogType::HOST_GPU,
|
||||
Common::Log::LogLevel::LERROR);
|
||||
}
|
||||
|
||||
// Helper method to determine whether to enable the debug report extension.
|
||||
|
|
|
@ -671,13 +671,13 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL DebugReportCallback(VkDebugReportFlagsEXT
|
|||
const std::string log_message =
|
||||
fmt::format("Vulkan debug report: ({}) {}", pLayerPrefix ? pLayerPrefix : "", pMessage);
|
||||
if (flags & VK_DEBUG_REPORT_ERROR_BIT_EXT)
|
||||
GENERIC_LOG_FMT(Common::Log::HOST_GPU, Common::Log::LERROR, "{}", log_message);
|
||||
ERROR_LOG_FMT(HOST_GPU, "{}", log_message);
|
||||
else if (flags & (VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT))
|
||||
GENERIC_LOG_FMT(Common::Log::HOST_GPU, Common::Log::LWARNING, "{}", log_message);
|
||||
WARN_LOG_FMT(HOST_GPU, "{}", log_message);
|
||||
else if (flags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT)
|
||||
GENERIC_LOG_FMT(Common::Log::HOST_GPU, Common::Log::LINFO, "{}", log_message);
|
||||
INFO_LOG_FMT(HOST_GPU, "{}", log_message);
|
||||
else
|
||||
GENERIC_LOG_FMT(Common::Log::HOST_GPU, Common::Log::LDEBUG, "{}", log_message);
|
||||
DEBUG_LOG_FMT(HOST_GPU, "{}", log_message);
|
||||
|
||||
return VK_FALSE;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "Common/CommonFuncs.h"
|
||||
#include "Common/DynamicLibrary.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "VideoBackends/Vulkan/VulkanLoader.h"
|
||||
|
@ -205,7 +204,8 @@ const char* VkResultToString(VkResult res)
|
|||
}
|
||||
}
|
||||
|
||||
void LogVulkanResult(int level, const char* func_name, VkResult res, const char* msg, ...)
|
||||
void LogVulkanResult(Common::Log::LogLevel level, const char* func_name, VkResult res,
|
||||
const char* msg, ...)
|
||||
{
|
||||
std::va_list ap;
|
||||
va_start(ap, msg);
|
||||
|
@ -215,7 +215,7 @@ void LogVulkanResult(int level, const char* func_name, VkResult res, const char*
|
|||
real_msg = fmt::format("({}) {} ({}: {})", func_name, real_msg, static_cast<int>(res),
|
||||
VkResultToString(res));
|
||||
|
||||
GENERIC_LOG_FMT(Common::Log::VIDEO, static_cast<Common::Log::LOG_LEVELS>(level), "{}", real_msg);
|
||||
GENERIC_LOG_FMT(Common::Log::LogType::VIDEO, level, "{}", real_msg);
|
||||
}
|
||||
|
||||
} // namespace Vulkan
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
#undef VULKAN_INSTANCE_ENTRY_POINT
|
||||
#undef VULKAN_MODULE_ENTRY_POINT
|
||||
|
||||
#include "Common/Logging/Log.h"
|
||||
|
||||
namespace Vulkan
|
||||
{
|
||||
bool LoadVulkanLibrary();
|
||||
|
@ -45,8 +47,10 @@ bool LoadVulkanDeviceFunctions(VkDevice device);
|
|||
void UnloadVulkanLibrary();
|
||||
|
||||
const char* VkResultToString(VkResult res);
|
||||
void LogVulkanResult(int level, const char* func_name, VkResult res, const char* msg, ...);
|
||||
void LogVulkanResult(Common::Log::LogLevel level, const char* func_name, VkResult res,
|
||||
const char* msg, ...);
|
||||
|
||||
#define LOG_VULKAN_ERROR(res, ...) LogVulkanResult(2, __func__, res, __VA_ARGS__)
|
||||
#define LOG_VULKAN_ERROR(res, ...) \
|
||||
LogVulkanResult(Common::Log::LogLevel::LERROR, __func__, res, __VA_ARGS__)
|
||||
|
||||
} // namespace Vulkan
|
||||
|
|
Loading…
Reference in New Issue