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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user