mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-08-27 12:34:00 -05:00
update console logging to using fwrite
This commit is contained in:
@@ -554,14 +554,19 @@ namespace coreinit
|
||||
std::unique_lock _l(sCafeConsoleMutex);
|
||||
CafeLogBuffer& logBuffer = getLogBuffer(cafeLogType);
|
||||
// once a line is full or \n is written it will be posted to log
|
||||
auto flushLine = [](CafeLogBuffer& cafeLogBuffer, std::string_view cafeLogName, bool forwardToConsole) -> void
|
||||
auto flushLine = [](CafeLogBuffer& cafeLogBuffer, std::string_view cafeLogName) -> void
|
||||
{
|
||||
cemuLog_log(LogType::CoreinitLogging, "[{0}] {1}", cafeLogName, std::basic_string_view(cafeLogBuffer.lineBuffer.data(), cafeLogBuffer.lineLength));
|
||||
if (forwardToConsole)
|
||||
std::cerr << fmt::format("{0}\n", std::basic_string_view(cafeLogBuffer.lineBuffer.data(), cafeLogBuffer.lineLength));
|
||||
cafeLogBuffer.lineLength = 0;
|
||||
};
|
||||
|
||||
if (s_forwardConsoleLogs) {
|
||||
if (cafeLogType == CafeLogType::OSCONSOLE) {
|
||||
fwrite(msg, 1, len, stdout);
|
||||
} else {
|
||||
fwrite(msg, 1, len, stderr);
|
||||
}
|
||||
}
|
||||
while (len)
|
||||
{
|
||||
char c = *msg;
|
||||
@@ -572,13 +577,13 @@ namespace coreinit
|
||||
if (c == '\n')
|
||||
{
|
||||
// flush line immediately
|
||||
flushLine(logBuffer, getLogBufferName(cafeLogType), s_forwardConsoleLogs);
|
||||
flushLine(logBuffer, getLogBufferName(cafeLogType));
|
||||
continue;
|
||||
}
|
||||
logBuffer.lineBuffer[logBuffer.lineLength] = c;
|
||||
logBuffer.lineLength++;
|
||||
if (logBuffer.lineLength >= logBuffer.lineBuffer.size())
|
||||
flushLine(logBuffer, getLogBufferName(cafeLogType), s_forwardConsoleLogs);
|
||||
flushLine(logBuffer, getLogBufferName(cafeLogType));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ bool LaunchSettings::HandleCommandline(const std::vector<std::wstring>& args)
|
||||
("account,a", po::value<std::string>(), "Persistent id of account")
|
||||
|
||||
("extra-mounts", po::wvalue<std::vector<std::wstring>>()->composing(), "A series of mounts in the form of: (path on host:path within emulated system, e.g. `/tmp:/vol/temporary/`)")
|
||||
("forward-console-logging", "Forward OSReport, OSConsoleWrite, etc. to stderr.")
|
||||
("forward-console-logging", "Forward OSReport, OSConsoleWrite, etc. to stdout/stderr.")
|
||||
("standalone-title-arguments", po::value<std::string>(), "Custom arguments to pass as arguments to a standalone RPX that is launched.")
|
||||
|
||||
("force-interpreter", po::value<bool>()->implicit_value(true), "Force interpreter CPU emulation, disables recompiler. Useful for debugging purposes where you want to get accurate memory accesses and stack traces.")
|
||||
|
||||
Reference in New Issue
Block a user