mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-30 06:32:56 +00:00
Common/LogManager: Add generic printf-style log function that takes a va_list instead of va_args.
This commit is contained in:
parent
120208ae03
commit
36134abd0e
@ -103,6 +103,9 @@ void GenericLog(LogLevel level, LogType type, const char* file, int line, const
|
||||
__attribute__((format(printf, 5, 6)))
|
||||
#endif
|
||||
;
|
||||
|
||||
void GenericLogV(LogLevel level, LogType type, const char* file, int line, const char* fmt,
|
||||
va_list args);
|
||||
} // namespace Common::Log
|
||||
|
||||
// Let the compiler optimize this out
|
||||
@ -139,6 +142,13 @@ void GenericLog(LogLevel level, LogType type, const char* file, int line, const
|
||||
GENERIC_LOG(Common::Log::LogType::t, Common::Log::LogLevel::LDEBUG, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define GENERIC_LOG_V(t, v, fmt, args) \
|
||||
do \
|
||||
{ \
|
||||
if (v <= Common::Log::MAX_LOGLEVEL) \
|
||||
Common::Log::GenericLogV(v, t, __FILE__, __LINE__, fmt, args); \
|
||||
} while (0)
|
||||
|
||||
// fmtlib capable API
|
||||
|
||||
#define GENERIC_LOG_FMT(t, v, format, ...) \
|
||||
|
@ -80,6 +80,22 @@ void GenericLog(LogLevel level, LogType type, const char* file, int line, const
|
||||
instance->Log(level, type, file, line, message);
|
||||
}
|
||||
|
||||
void GenericLogV(LogLevel level, LogType type, const char* file, int line, const char* fmt,
|
||||
va_list args)
|
||||
{
|
||||
auto* instance = LogManager::GetInstance();
|
||||
if (instance == nullptr)
|
||||
return;
|
||||
|
||||
if (!instance->IsEnabled(type, level))
|
||||
return;
|
||||
|
||||
char message[MAX_MSGLEN];
|
||||
CharArrayFromFormatV(message, MAX_MSGLEN, fmt, args);
|
||||
|
||||
instance->Log(level, type, file, line, message);
|
||||
}
|
||||
|
||||
void GenericLogFmtImpl(LogLevel level, LogType type, const char* file, int line,
|
||||
fmt::string_view format, const fmt::format_args& args)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user