mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-27 14:54:19 +01:00
Merge pull request #1078 from lioncash/message
lm: Handle threads and modules within the logger
This commit is contained in:
commit
c00b374e78
@ -92,7 +92,11 @@ private:
|
|||||||
|
|
||||||
// Parse out log metadata
|
// Parse out log metadata
|
||||||
u32 line{};
|
u32 line{};
|
||||||
std::string message, filename, function;
|
std::string module;
|
||||||
|
std::string message;
|
||||||
|
std::string filename;
|
||||||
|
std::string function;
|
||||||
|
std::string thread;
|
||||||
while (addr < end_addr) {
|
while (addr < end_addr) {
|
||||||
const Field field{static_cast<Field>(Memory::Read8(addr++))};
|
const Field field{static_cast<Field>(Memory::Read8(addr++))};
|
||||||
const size_t length{Memory::Read8(addr++)};
|
const size_t length{Memory::Read8(addr++)};
|
||||||
@ -102,6 +106,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (field) {
|
switch (field) {
|
||||||
|
case Field::Skip:
|
||||||
|
break;
|
||||||
case Field::Message:
|
case Field::Message:
|
||||||
message = Memory::ReadCString(addr, length);
|
message = Memory::ReadCString(addr, length);
|
||||||
break;
|
break;
|
||||||
@ -114,6 +120,12 @@ private:
|
|||||||
case Field::Function:
|
case Field::Function:
|
||||||
function = Memory::ReadCString(addr, length);
|
function = Memory::ReadCString(addr, length);
|
||||||
break;
|
break;
|
||||||
|
case Field::Module:
|
||||||
|
module = Memory::ReadCString(addr, length);
|
||||||
|
break;
|
||||||
|
case Field::Thread:
|
||||||
|
thread = Memory::ReadCString(addr, length);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr += length;
|
addr += length;
|
||||||
@ -128,12 +140,18 @@ private:
|
|||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
log_stream << filename << ':';
|
log_stream << filename << ':';
|
||||||
}
|
}
|
||||||
|
if (!module.empty()) {
|
||||||
|
log_stream << module << ':';
|
||||||
|
}
|
||||||
if (!function.empty()) {
|
if (!function.empty()) {
|
||||||
log_stream << function << ':';
|
log_stream << function << ':';
|
||||||
}
|
}
|
||||||
if (line) {
|
if (line) {
|
||||||
log_stream << std::to_string(line) << ':';
|
log_stream << std::to_string(line) << ':';
|
||||||
}
|
}
|
||||||
|
if (!thread.empty()) {
|
||||||
|
log_stream << thread << ':';
|
||||||
|
}
|
||||||
if (log_stream.str().length() > 0 && log_stream.str().back() == ':') {
|
if (log_stream.str().length() > 0 && log_stream.str().back() == ':') {
|
||||||
log_stream << ' ';
|
log_stream << ' ';
|
||||||
}
|
}
|
||||||
@ -142,7 +160,7 @@ private:
|
|||||||
if (header.IsTailLog()) {
|
if (header.IsTailLog()) {
|
||||||
switch (header.severity) {
|
switch (header.severity) {
|
||||||
case MessageHeader::Severity::Trace:
|
case MessageHeader::Severity::Trace:
|
||||||
LOG_TRACE(Debug_Emulated, "{}", log_stream.str());
|
LOG_DEBUG(Debug_Emulated, "{}", log_stream.str());
|
||||||
break;
|
break;
|
||||||
case MessageHeader::Severity::Info:
|
case MessageHeader::Severity::Info:
|
||||||
LOG_INFO(Debug_Emulated, "{}", log_stream.str());
|
LOG_INFO(Debug_Emulated, "{}", log_stream.str());
|
||||||
|
Loading…
Reference in New Issue
Block a user