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:
David Markowitz
2026-09-26 19:35:58 -07:00
committed by GitHub
parent 129199e452
commit 6f3a8d502f
7 changed files with 47 additions and 22 deletions

View File

@@ -40,7 +40,9 @@ void HandlePacket(Packet* packet);
int main(int argc, char** argv) {
constexpr uint32_t authFramerate = mediumFramerate;
constexpr uint32_t authFrameDelta = mediumFrameDelta;
Diagnostics::SetProcessName("Auth");
const auto curTimeStr = std::to_string(time(nullptr));
const auto serviceName = "AuthServer_" + curTimeStr;
Diagnostics::SetProcessName(serviceName);
Diagnostics::SetProcessFileName(argv[0]);
Diagnostics::Initialize();
@@ -50,7 +52,7 @@ int main(int argc, char** argv) {
Game::config = new dConfig("authconfig.ini");
//Create all the objects we need to run our service:
Server::SetupLogger("AuthServer");
Server::SetupLogger(serviceName, "AuthServer");
if (!Game::logger) return EXIT_FAILURE;
Game::config->LogSettings();
@@ -62,7 +64,7 @@ int main(int argc, char** argv) {
Database::Connect();
} catch (std::exception& ex) {
LOG("Got an error while connecting to the database: %s", ex.what());
Database::Destroy("AuthServer");
Database::Destroy(serviceName);
delete Game::server;
delete Game::logger;
return EXIT_FAILURE;
@@ -156,7 +158,7 @@ int main(int argc, char** argv) {
LOG("Exited Main Loop! (signal %d)", Game::lastSignal);
//Delete our objects here:
Database::Destroy("AuthServer");
Database::Destroy(serviceName);
delete Game::server;
delete Game::logger;
delete Game::config;