mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-01 02:13:44 +00:00
feat: logging structure improvements (#2037)
* feat: logging structure improvements tested that logs are sorted by the folder argument and that the directories are created recursively. tested that crash dumps follow the same exact name (+Crash_...name..._pid.log) so you can match the crash dump to the corresponding log file much easier * Potential fix for pull request finding 'Use parsed cloneID when constructing the log folder' Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * const --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -61,6 +61,10 @@ namespace Game {
|
||||
std::mt19937 randomEngine;
|
||||
} //namespace Game
|
||||
|
||||
namespace {
|
||||
std::string g_ServiceName;
|
||||
}
|
||||
|
||||
bool shutdownSequenceStarted = false;
|
||||
int ShutdownSequence(int32_t signal = -1);
|
||||
int32_t FinalizeShutdown(int32_t signal = -1);
|
||||
@@ -80,7 +84,9 @@ int GenerateBCryptPassword(const std::string& password, const int workFactor, ch
|
||||
int main(int argc, char** argv) {
|
||||
constexpr uint32_t masterFramerate = mediumFramerate;
|
||||
constexpr uint32_t masterFrameDelta = mediumFrameDelta;
|
||||
Diagnostics::SetProcessName("Master");
|
||||
const auto curTimeStr = std::to_string(time(nullptr));
|
||||
g_ServiceName = "MasterServer_" + curTimeStr;
|
||||
Diagnostics::SetProcessName(g_ServiceName);
|
||||
Diagnostics::SetProcessFileName(argv[0]);
|
||||
Diagnostics::Initialize();
|
||||
|
||||
@@ -96,7 +102,7 @@ int main(int argc, char** argv) {
|
||||
Game::config = new dConfig("masterconfig.ini");
|
||||
|
||||
//Create all the objects we need to run our service:
|
||||
Server::SetupLogger("MasterServer");
|
||||
Server::SetupLogger(g_ServiceName, "MasterServer");
|
||||
if (!Game::logger) return EXIT_FAILURE;
|
||||
Game::config->LogSettings();
|
||||
|
||||
@@ -914,7 +920,7 @@ int ShutdownSequence(int32_t signal) {
|
||||
|
||||
int32_t FinalizeShutdown(int32_t signal) {
|
||||
//Delete our objects here:
|
||||
Database::Destroy("MasterServer");
|
||||
Database::Destroy(g_ServiceName);
|
||||
if (Game::config) delete Game::config;
|
||||
Game::config = nullptr;
|
||||
if (Game::im) delete Game::im;
|
||||
|
||||
Reference in New Issue
Block a user