Merge pull request #203 from cooltrain7/Log-Line-Cleaning

Added Log content additions
This commit is contained in:
Xiphoseer 2022-01-04 13:15:24 +01:00 committed by GitHub
commit 8ed7690b96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 18 deletions

View File

@ -354,7 +354,7 @@ void ChatPacketHandler::HandleTeamInvite(Packet* packet)
if (team->memberIDs.size() > 3) { if (team->memberIDs.size() > 3) {
// no more teams greater than 4 // no more teams greater than 4
Game::logger->Log("ChatPacketHandler", "Someone tried to invite a 5th player to a team"); Game::logger->Log("ChatPacketHandler", "Someone tried to invite a 5th player to a team\n");
return; return;
} }

View File

@ -28,7 +28,7 @@ void Database::Connect(const string& host, const string& database, const string&
void Database::Destroy() { void Database::Destroy() {
if (!con) return; if (!con) return;
cout << "Destroying MySQL connection!" << endl; Game::logger->Log("Database", "Destroying MySQL connection!\n");
con->close(); con->close();
delete con; delete con;
} //Destroy } //Destroy

View File

@ -23,7 +23,7 @@ void VerifyBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
if (self == nullptr) if (self == nullptr)
{ {
Game::logger->Log("VerifyBehavior", "Invalid self for (%llu)", context->originator); Game::logger->Log("VerifyBehavior", "Invalid self for (%llu)\n", context->originator);
return; return;
} }

View File

@ -5672,7 +5672,7 @@ void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Enti
return; return;
} }
Game::logger->Log("GameMessages", "Build area found: %llu", buildArea->GetObjectID()); Game::logger->Log("GameMessages", "Build area found: %llu\n", buildArea->GetObjectID());
GameMessages::SendStartArrangingWithItem( GameMessages::SendStartArrangingWithItem(
character, character,

View File

@ -645,7 +645,7 @@ void HandlePacket(Packet* packet) {
} }
case MSG_MASTER_SHUTDOWN_UNIVERSE: { case MSG_MASTER_SHUTDOWN_UNIVERSE: {
Game::logger->Log("MasterServer","Received shutdown universe command, ""shutting down in 10 minutes.\n"); Game::logger->Log("MasterServer","Received shutdown universe command, shutting down in 10 minutes.\n");
shouldShutdown = true; shouldShutdown = true;
break; break;
} }
@ -707,7 +707,7 @@ void ShutdownSequence() {
auto* objIdManager = ObjectIDManager::TryInstance(); auto* objIdManager = ObjectIDManager::TryInstance();
if (objIdManager != nullptr) { if (objIdManager != nullptr) {
objIdManager->SaveToDatabase(); objIdManager->SaveToDatabase();
printf("Saved objidtracker...\n"); Game::logger->Log("MasterServer", "Saved ObjectIDTracker to DB\n");
} }
auto t = std::chrono::high_resolution_clock::now(); auto t = std::chrono::high_resolution_clock::now();
@ -717,7 +717,8 @@ void ShutdownSequence() {
exit(0); exit(0);
} }
printf("Attempting to shutdown instances, max 60 seconds...\n"); Game::logger->Log("MasterServer", "Attempting to shutdown instances, max 60 seconds...\n");
while (true) { while (true) {
auto done = true; auto done = true;

View File

@ -104,13 +104,13 @@ Packet* dServer::ReceiveFromMaster() {
if (packet->length < 1) { mMasterPeer->DeallocatePacket(packet); return nullptr; } if (packet->length < 1) { mMasterPeer->DeallocatePacket(packet); return nullptr; }
if (packet->data[0] == ID_DISCONNECTION_NOTIFICATION || packet->data[0] == ID_CONNECTION_LOST) { if (packet->data[0] == ID_DISCONNECTION_NOTIFICATION || packet->data[0] == ID_CONNECTION_LOST) {
mLogger->Log("Server", "Lost our connection to master, shutting DOWN!\n"); mLogger->Log("dServer", "Lost our connection to master, shutting DOWN!\n");
mMasterConnectionActive = false; mMasterConnectionActive = false;
//ConnectToMaster(); //We'll just shut down now //ConnectToMaster(); //We'll just shut down now
} }
if (packet->data[0] == ID_CONNECTION_REQUEST_ACCEPTED) { if (packet->data[0] == ID_CONNECTION_REQUEST_ACCEPTED) {
mLogger->Log("Server", "Established connection to master\n"); mLogger->Log("dServer", "Established connection to master, zone (%i), instance (%i)\n",this->GetZoneID(), this->GetInstanceID());
mMasterConnectionActive = true; mMasterConnectionActive = true;
mMasterSystemAddress = packet->systemAddress; mMasterSystemAddress = packet->systemAddress;
MasterPackets::SendServerInfo(this, packet); MasterPackets::SendServerInfo(this, packet);
@ -127,6 +127,7 @@ Packet* dServer::ReceiveFromMaster() {
//When we handle these packets in World instead dServer, we just return the packet's pointer. //When we handle these packets in World instead dServer, we just return the packet's pointer.
default: default:
return packet; return packet;
} }
} }

View File

@ -475,7 +475,7 @@ int main(int argc, char** argv) {
if (framesSinceMasterStatus >= 200) if (framesSinceMasterStatus >= 200)
{ {
Game::logger->Log("WorldServer", "Finished loading world, ready up!\n"); Game::logger->Log("WorldServer", "Finished loading world with zone (%i), ready up!\n", Game::server->GetZoneID());
MasterPackets::SendWorldReady(Game::server, Game::server->GetZoneID(), Game::server->GetInstanceID()); MasterPackets::SendWorldReady(Game::server, Game::server->GetZoneID(), Game::server->GetInstanceID());
@ -546,7 +546,7 @@ int main(int argc, char** argv) {
if (Game::physicsWorld) Game::physicsWorld = nullptr; if (Game::physicsWorld) Game::physicsWorld = nullptr;
if (Game::zoneManager) delete Game::zoneManager; if (Game::zoneManager) delete Game::zoneManager;
Game::logger->Log("Test", "Quitting\n"); Game::logger->Log("WorldServer", "Shutdown complete, zone (%i), instance (%i)\n", Game::server->GetZoneID(), instanceID);
Metrics::Clear(); Metrics::Clear();
Database::Destroy(); Database::Destroy();
@ -573,13 +573,13 @@ dLogger * SetupLogger(int zoneID, int instanceID) {
void HandlePacketChat(Packet* packet) { void HandlePacketChat(Packet* packet) {
if (packet->data[0] == ID_DISCONNECTION_NOTIFICATION || packet->data[0] == ID_CONNECTION_LOST) { if (packet->data[0] == ID_DISCONNECTION_NOTIFICATION || packet->data[0] == ID_CONNECTION_LOST) {
Game::logger->Log("WorldServer", "Lost our connection to chat.\n"); Game::logger->Log("WorldServer", "Lost our connection to chat, zone(%i), instance(%i)\n", Game::server->GetZoneID(), Game::server->GetInstanceID());
chatConnected = false; chatConnected = false;
} }
if (packet->data[0] == ID_CONNECTION_REQUEST_ACCEPTED) { if (packet->data[0] == ID_CONNECTION_REQUEST_ACCEPTED) {
Game::logger->Log("WorldServer", "Established connection to chat\n"); Game::logger->Log("WorldServer", "Established connection to chat, zone(%i), instance (%i)\n",Game::server -> GetZoneID(), Game::server -> GetInstanceID());
Game::chatSysAddr = packet->systemAddress; Game::chatSysAddr = packet->systemAddress;
chatConnected = true; chatConnected = true;
@ -863,7 +863,7 @@ void HandlePacket(Packet* packet) {
case MSG_MASTER_SHUTDOWN: { case MSG_MASTER_SHUTDOWN: {
worldShutdownSequenceStarted = true; worldShutdownSequenceStarted = true;
Game::logger->Log("WorldServer", "Got shutdown request\n"); Game::logger->Log("WorldServer", "Got shutdown request from master, zone (%i), instance (%i)\n", Game::server->GetZoneID(), Game::server->GetInstanceID());
break; break;
} }
@ -1186,11 +1186,11 @@ void HandlePacket(Packet* packet) {
} }
} }
else { else {
Game::logger->Log("WorldMain", "Couldn't find character to log in with for user %s (%i)!\n", user->GetUsername().c_str(), user->GetAccountID()); Game::logger->Log("WorldServer", "Couldn't find character to log in with for user %s (%i)!\n", user->GetUsername().c_str(), user->GetAccountID());
Game::server->Disconnect(packet->systemAddress, SERVER_DISCON_CHARACTER_NOT_FOUND); Game::server->Disconnect(packet->systemAddress, SERVER_DISCON_CHARACTER_NOT_FOUND);
} }
} else { } else {
Game::logger->Log("WorldMain", "Couldn't get user for level load complete!\n"); Game::logger->Log("WorldServer", "Couldn't get user for level load complete!\n");
} }
break; break;
} }
@ -1296,7 +1296,7 @@ void WorldShutdownSequence()
auto t = std::chrono::high_resolution_clock::now(); auto t = std::chrono::high_resolution_clock::now();
auto ticks = 0; auto ticks = 0;
printf("Attempting to shutdown world, max 10 seconds...");; Game::logger->Log("WorldServer", "Attempting to shutdown world, zone (%i), instance (%i), max 10 seconds...\n", Game::server->GetZoneID(), instanceID);
while (true) while (true)
{ {