aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDLL')
-rw-r--r--NorthstarDLL/dedicated/dedicated.cpp3
-rw-r--r--NorthstarDLL/logging/crashhandler.cpp2
-rw-r--r--NorthstarDLL/logging/logging.cpp8
-rw-r--r--NorthstarDLL/logging/logging.h2
4 files changed, 15 insertions, 0 deletions
diff --git a/NorthstarDLL/dedicated/dedicated.cpp b/NorthstarDLL/dedicated/dedicated.cpp
index 8f6f8fe6..3d7d756c 100644
--- a/NorthstarDLL/dedicated/dedicated.cpp
+++ b/NorthstarDLL/dedicated/dedicated.cpp
@@ -278,7 +278,10 @@ void, __fastcall, (void* sqvm))
// atm, this will crash if not aborted, so this just closes more gracefully
static ConVar* Cvar_fatal_script_errors = g_pCVar->FindVar("fatal_script_errors");
if (Cvar_fatal_script_errors->GetBool())
+ {
+ NS::log::FlushLoggers();
abort();
+ }
}
ON_DLL_LOAD_DEDI("server.dll", DedicatedServerGameDLL, (CModule module))
diff --git a/NorthstarDLL/logging/crashhandler.cpp b/NorthstarDLL/logging/crashhandler.cpp
index d4a54169..1e9bf4b3 100644
--- a/NorthstarDLL/logging/crashhandler.cpp
+++ b/NorthstarDLL/logging/crashhandler.cpp
@@ -72,6 +72,8 @@ void PrintExceptionLog(ExceptionLog& exc)
"Northstar has crashed! Crash info can be found in R2Northstar/logs",
"Northstar has crashed!",
MB_ICONERROR | MB_OK | MB_SYSTEMMODAL);
+
+ NS::log::FlushLoggers();
}
std::string GetExceptionName(ExceptionLog& exc)
diff --git a/NorthstarDLL/logging/logging.cpp b/NorthstarDLL/logging/logging.cpp
index 6bb57170..8b906911 100644
--- a/NorthstarDLL/logging/logging.cpp
+++ b/NorthstarDLL/logging/logging.cpp
@@ -203,3 +203,11 @@ void InitialiseLogging()
loggers.push_back(NS::log::rpak);
loggers.push_back(NS::log::echo);
}
+
+void NS::log::FlushLoggers()
+{
+ for (auto& logger : loggers)
+ logger->flush();
+
+ spdlog::default_logger()->flush();
+}
diff --git a/NorthstarDLL/logging/logging.h b/NorthstarDLL/logging/logging.h
index b710915e..2cccdde6 100644
--- a/NorthstarDLL/logging/logging.h
+++ b/NorthstarDLL/logging/logging.h
@@ -100,6 +100,8 @@ namespace NS::log
extern std::shared_ptr<ColoredLogger> echo;
extern std::shared_ptr<ColoredLogger> NORTHSTAR;
+
+ void FlushLoggers();
}; // namespace NS::log
void RegisterCustomSink(std::shared_ptr<CustomSink> sink);