Improve error formatting

This commit is contained in:
Nekotekina 2017-08-08 22:13:48 +03:00
parent 009f53a267
commit 613214cdca
3 changed files with 44 additions and 46 deletions

View file

@ -791,7 +791,7 @@ void Emulator::Stop()
#endif
}
s32 error_code::error_report(const fmt_type_info* sup, u64 arg)
s32 error_code::error_report(const fmt_type_info* sup, u64 arg, const fmt_type_info* sup2, u64 arg2)
{
static thread_local std::unordered_map<std::string, std::size_t>* g_tls_error_stats{};
static thread_local std::string* g_tls_error_str{};
@ -843,7 +843,7 @@ s32 error_code::error_report(const fmt_type_info* sup, u64 arg)
// Format log message (use preallocated buffer)
g_tls_error_str->clear();
fmt::append(*g_tls_error_str, "'%s' failed with 0x%08x%s%s", func, arg, sup ? " : " : "", std::make_pair(sup, arg));
fmt::append(*g_tls_error_str, "'%s' failed with 0x%08x%s%s%s%s", func, arg, sup ? " : " : "", std::make_pair(sup, arg), sup2 ? ", " : "", std::make_pair(sup2, arg2));
// Update stats and check log threshold
const auto stat = ++(*g_tls_error_stats)[*g_tls_error_str];