Add instant log flush option (#209)

This commit is contained in:
PabloMK7
2024-07-21 12:36:00 +02:00
parent 60c29ede5e
commit efe2ee6a43
12 changed files with 45 additions and 3 deletions

View File

@@ -68,7 +68,7 @@ public:
}
void Flush() override {
// stderr shouldn't be buffered
std::fflush(stderr);
}
void EnableForStacktrace() override {
@@ -263,7 +263,14 @@ public:
!boost::regex_search(FormatLogMessage(new_entry), regex_filter)) {
return;
}
message_queue.EmplaceWait(new_entry);
if (Settings::values.instant_debug_log.GetValue()) {
ForEachBackend([&new_entry](Backend& backend) {
backend.Write(new_entry);
backend.Flush();
});
} else {
message_queue.EmplaceWait(new_entry);
}
}
private:

View File

@@ -147,6 +147,7 @@ void LogSettings() {
log_setting("Debugging_DelayStartForLLEModules", values.delay_start_for_lle_modules.GetValue());
log_setting("Debugging_UseGdbstub", values.use_gdbstub.GetValue());
log_setting("Debugging_GdbstubPort", values.gdbstub_port.GetValue());
log_setting("Debugging_InstantDebugLog", values.instant_debug_log.GetValue());
}
bool IsConfiguringGlobal() {

View File

@@ -542,6 +542,7 @@ struct Values {
Setting<bool> delay_start_for_lle_modules{true, "delay_start_for_lle_modules"};
Setting<bool> use_gdbstub{false, "use_gdbstub"};
Setting<u16> gdbstub_port{24689, "gdbstub_port"};
Setting<bool> instant_debug_log{false, "instant_debug_log"};
// Miscellaneous
Setting<std::string> log_filter{"*:Info", "log_filter"};