diff options
Diffstat (limited to 'src/server/worldserver')
-rw-r--r-- | src/server/worldserver/Main.cpp | 46 | ||||
-rw-r--r-- | src/server/worldserver/RemoteAccess/RASession.cpp | 14 | ||||
-rw-r--r-- | src/server/worldserver/TCSoap/TCSoap.cpp | 14 |
3 files changed, 37 insertions, 37 deletions
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 9f601f8ceb1..86d8ac7d18d 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -201,18 +201,18 @@ extern int main(int argc, char** argv) Trinity::Banner::Show("worldserver-daemon", [](char const* text) { - TC_LOG_INFO("server.worldserver", "%s", text); + TC_LOG_INFO("server.worldserver", "{}", text); }, []() { - TC_LOG_INFO("server.worldserver", "Using configuration file %s.", sConfigMgr->GetFilename().c_str()); - TC_LOG_INFO("server.worldserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, OpenSSL_version(OPENSSL_VERSION)); - TC_LOG_INFO("server.worldserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100); + TC_LOG_INFO("server.worldserver", "Using configuration file {}.", sConfigMgr->GetFilename()); + TC_LOG_INFO("server.worldserver", "Using SSL version: {} (library: {})", OPENSSL_VERSION_TEXT, OpenSSL_version(OPENSSL_VERSION)); + TC_LOG_INFO("server.worldserver", "Using Boost version: {}.{}.{}", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100); } ); for (std::string const& key : overriddenKeys) - TC_LOG_INFO("server.worldserver", "Configuration field '%s' was overridden with environment variable.", key.c_str()); + TC_LOG_INFO("server.worldserver", "Configuration field '{}' was overridden with environment variable.", key); OpenSSLCrypto::threadsSetup(boost::dll::program_location().remove_filename()); @@ -228,10 +228,10 @@ extern int main(int argc, char** argv) if (!pidFile.empty()) { if (uint32 pid = CreatePIDFile(pidFile)) - TC_LOG_INFO("server.worldserver", "Daemon PID: %u\n", pid); + TC_LOG_INFO("server.worldserver", "Daemon PID: {}\n", pid); else { - TC_LOG_ERROR("server.worldserver", "Cannot create PID file %s.\n", pidFile.c_str()); + TC_LOG_ERROR("server.worldserver", "Cannot create PID file {}.\n", pidFile); return 1; } } @@ -268,7 +268,7 @@ extern int main(int argc, char** argv) return 0; // Set server offline (not connectable) - LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realm.Id.Realm); + LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | {} WHERE id = '{}'", REALM_FLAG_OFFLINE, realm.Id.Realm); LoadRealmInfo(*ioContext); @@ -358,7 +358,7 @@ extern int main(int argc, char** argv) }); // Set server online (allow connecting now) - LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_OFFLINE, realm.Id.Realm); + LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~{}, population = 0 WHERE id = '{}'", REALM_FLAG_OFFLINE, realm.Id.Realm); realm.PopulationLevel = 0.0f; realm.Flags = RealmFlags(realm.Flags & ~uint32(REALM_FLAG_OFFLINE)); @@ -368,10 +368,10 @@ extern int main(int argc, char** argv) { freezeDetector = std::make_shared<FreezeDetector>(*ioContext, coreStuckTime * 1000); FreezeDetector::Start(freezeDetector); - TC_LOG_INFO("server.worldserver", "Starting up anti-freeze thread (%u seconds max stuck time)...", coreStuckTime); + TC_LOG_INFO("server.worldserver", "Starting up anti-freeze thread ({} seconds max stuck time)...", coreStuckTime); } - TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon) ready...", GitRevision::GetFullVersion()); + TC_LOG_INFO("server.worldserver", "{} (worldserver-daemon) ready...", GitRevision::GetFullVersion()); sScriptMgr->OnStartup(); @@ -398,7 +398,7 @@ extern int main(int argc, char** argv) sScriptMgr->OnShutdown(); // set server offline - LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realm.Id.Realm); + LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | {} WHERE id = '{}'", REALM_FLAG_OFFLINE, realm.Id.Realm); TC_LOG_INFO("server.worldserver", "Halting process..."); @@ -426,7 +426,7 @@ void ShutdownCLIThread(std::thread* cliThread) if (!formatReturnCode) errorBuffer = "Unknown error"; - TC_LOG_DEBUG("server.worldserver", "Error cancelling I/O of CliThread, error code %u, detail: %s", uint32(errorCode), errorBuffer); + TC_LOG_DEBUG("server.worldserver", "Error cancelling I/O of CliThread, error code {}, detail: {}", uint32(errorCode), errorBuffer); if (!formatReturnCode) LocalFree((LPSTR)errorBuffer); @@ -496,7 +496,7 @@ void WorldUpdateLoop() { uint32 sleepTime = minUpdateDiff - diff; if (sleepTime >= halfMaxCoreStuckTime) - TC_LOG_ERROR("server.worldserver", "WorldUpdateLoop() waiting for %u ms with MaxCoreStuckTime set to %u ms", sleepTime, maxCoreStuckTime); + TC_LOG_ERROR("server.worldserver", "WorldUpdateLoop() waiting for {} ms with MaxCoreStuckTime set to {} ms", sleepTime, maxCoreStuckTime); // sleep until enough time passes that we can update all timers std::this_thread::sleep_for(Milliseconds(sleepTime)); continue; @@ -545,7 +545,7 @@ void FreezeDetector::Handler(std::weak_ptr<FreezeDetector> freezeDetectorRef, bo uint32 msTimeDiff = getMSTimeDiff(freezeDetector->_lastChangeMsTime, curtime); if (msTimeDiff > freezeDetector->_maxCoreStuckTimeInMs) { - TC_LOG_ERROR("server.worldserver", "World Thread hangs for %u ms, forcing a crash!", msTimeDiff); + TC_LOG_ERROR("server.worldserver", "World Thread hangs for {} ms, forcing a crash!", msTimeDiff); ABORT_MSG("World Thread hangs for %u ms, forcing a crash!", msTimeDiff); } } @@ -578,7 +578,7 @@ AsyncAcceptor* StartRaSocketAcceptor(Trinity::Asio::IoContext& ioContext) bool LoadRealmInfo(Trinity::Asio::IoContext& ioContext) { - QueryResult result = LoginDatabase.PQuery("SELECT id, name, address, localAddress, localSubnetMask, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist WHERE id = %u", realm.Id.Realm); + QueryResult result = LoginDatabase.PQuery("SELECT id, name, address, localAddress, localSubnetMask, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist WHERE id = {}", realm.Id.Realm); if (!result) return false; @@ -589,7 +589,7 @@ bool LoadRealmInfo(Trinity::Asio::IoContext& ioContext) Optional<boost::asio::ip::tcp::endpoint> externalAddress = resolver.Resolve(boost::asio::ip::tcp::v4(), fields[2].GetString(), ""); if (!externalAddress) { - TC_LOG_ERROR("server.worldserver", "Could not resolve address %s", fields[2].GetString().c_str()); + TC_LOG_ERROR("server.worldserver", "Could not resolve address {}", fields[2].GetString()); return false; } @@ -598,7 +598,7 @@ bool LoadRealmInfo(Trinity::Asio::IoContext& ioContext) Optional<boost::asio::ip::tcp::endpoint> localAddress = resolver.Resolve(boost::asio::ip::tcp::v4(), fields[3].GetString(), ""); if (!localAddress) { - TC_LOG_ERROR("server.worldserver", "Could not resolve address %s", fields[3].GetString().c_str()); + TC_LOG_ERROR("server.worldserver", "Could not resolve address {}", fields[3].GetString()); return false; } @@ -607,7 +607,7 @@ bool LoadRealmInfo(Trinity::Asio::IoContext& ioContext) Optional<boost::asio::ip::tcp::endpoint> localSubmask = resolver.Resolve(boost::asio::ip::tcp::v4(), fields[4].GetString(), ""); if (!localSubmask) { - TC_LOG_ERROR("server.worldserver", "Could not resolve address %s", fields[4].GetString().c_str()); + TC_LOG_ERROR("server.worldserver", "Could not resolve address {}", fields[4].GetString()); return false; } @@ -646,17 +646,17 @@ bool StartDB() return false; } - TC_LOG_INFO("server.worldserver", "Realm running as realm ID %d", realm.Id.Realm); + TC_LOG_INFO("server.worldserver", "Realm running as realm ID {}", realm.Id.Realm); ///- Clean the database before starting ClearOnlineAccounts(); ///- Insert version info into DB - WorldDatabase.PExecute("UPDATE version SET core_version = '%s', core_revision = '%s'", GitRevision::GetFullVersion(), GitRevision::GetHash()); // One-time query + WorldDatabase.PExecute("UPDATE version SET core_version = '{}', core_revision = '{}'", GitRevision::GetFullVersion(), GitRevision::GetHash()); // One-time query sWorld->LoadDBVersion(); - TC_LOG_INFO("server.worldserver", "Using World DB: %s", sWorld->GetDBVersion()); + TC_LOG_INFO("server.worldserver", "Using World DB: {}", sWorld->GetDBVersion()); return true; } @@ -673,7 +673,7 @@ void StopDB() void ClearOnlineAccounts() { // Reset online status for all accounts with characters on the current realm - LoginDatabase.DirectPExecute("UPDATE account SET online = 0 WHERE online > 0 AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = %d)", realm.Id.Realm); + LoginDatabase.DirectPExecute("UPDATE account SET online = 0 WHERE online > 0 AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = {})", realm.Id.Realm); // Reset online status for all characters CharacterDatabase.DirectExecute("UPDATE characters SET online = 0 WHERE online <> 0"); diff --git a/src/server/worldserver/RemoteAccess/RASession.cpp b/src/server/worldserver/RemoteAccess/RASession.cpp index 4355df67506..f2b1833704e 100644 --- a/src/server/worldserver/RemoteAccess/RASession.cpp +++ b/src/server/worldserver/RemoteAccess/RASession.cpp @@ -57,7 +57,7 @@ void RASession::Start() if (username.empty()) return; - TC_LOG_INFO("commands.ra", "Accepting RA connection from user %s (IP: %s)", username.c_str(), GetRemoteIpAddress().c_str()); + TC_LOG_INFO("commands.ra", "Accepting RA connection from user {} (IP: {})", username, GetRemoteIpAddress()); Send("Password: "); @@ -72,7 +72,7 @@ void RASession::Start() return; } - TC_LOG_INFO("commands.ra", "User %s (IP: %s) authenticated correctly to RA", username.c_str(), GetRemoteIpAddress().c_str()); + TC_LOG_INFO("commands.ra", "User {} (IP: {}) authenticated correctly to RA", username, GetRemoteIpAddress()); // Authentication successful, send the motd Send(std::string(std::string(Motd::GetMotd()) + "\r\n").c_str()); @@ -131,7 +131,7 @@ bool RASession::CheckAccessLevel(const std::string& user) if (!result) { - TC_LOG_INFO("commands.ra", "User %s does not exist in database", user.c_str()); + TC_LOG_INFO("commands.ra", "User {} does not exist in database", user); return false; } @@ -139,12 +139,12 @@ bool RASession::CheckAccessLevel(const std::string& user) if (fields[1].GetUInt8() < sConfigMgr->GetIntDefault("Ra.MinLevel", 3)) { - TC_LOG_INFO("commands.ra", "User %s has no privilege to login", user.c_str()); + TC_LOG_INFO("commands.ra", "User {} has no privilege to login", user); return false; } else if (fields[2].GetInt32() != -1) { - TC_LOG_INFO("commands.ra", "User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str()); + TC_LOG_INFO("commands.ra", "User {} has to be assigned on all realms (with RealmID = '-1')", user); return false; } @@ -174,7 +174,7 @@ bool RASession::CheckPassword(const std::string& user, const std::string& pass) return true; } - TC_LOG_INFO("commands.ra", "Wrong password for user: %s", user.c_str()); + TC_LOG_INFO("commands.ra", "Wrong password for user: {}", user); return false; } @@ -183,7 +183,7 @@ bool RASession::ProcessCommand(std::string& command) if (command.length() == 0) return true; - TC_LOG_INFO("commands.ra", "Received command: %s", command.c_str()); + TC_LOG_INFO("commands.ra", "Received command: {}", command); // handle quit, exit and logout commands to terminate connection if (command == "quit" || command == "exit" || command == "logout") diff --git a/src/server/worldserver/TCSoap/TCSoap.cpp b/src/server/worldserver/TCSoap/TCSoap.cpp index cbfabdf207d..562ede3a310 100644 --- a/src/server/worldserver/TCSoap/TCSoap.cpp +++ b/src/server/worldserver/TCSoap/TCSoap.cpp @@ -40,18 +40,18 @@ void TCSoapThread(const std::string& host, uint16 port) soap.send_timeout = 5; if (!soap_valid_socket(soap_bind(&soap, host.c_str(), port, 100))) { - TC_LOG_ERROR("network.soap", "Couldn't bind to %s:%d", host.c_str(), port); + TC_LOG_ERROR("network.soap", "Couldn't bind to {}:{}", host, port); exit(-1); } - TC_LOG_INFO("network.soap", "Bound to http://%s:%d", host.c_str(), port); + TC_LOG_INFO("network.soap", "Bound to http://{}:{}", host, port); while (!World::IsStopped()) { if (!soap_valid_socket(soap_accept(&soap))) continue; // ran into an accept timeout - TC_LOG_DEBUG("network.soap", "Accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF); + TC_LOG_DEBUG("network.soap", "Accepted connection from IP={}.{}.{}.{}", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF); struct soap* thread_soap = soap_copy(&soap);// make a safe copy process_message(thread_soap); } @@ -87,26 +87,26 @@ int ns1__executeCommand(soap* soap, char* command, char** result) uint32 accountId = AccountMgr::GetId(soap->userid); if (!accountId) { - TC_LOG_INFO("network.soap", "Client used invalid username '%s'", soap->userid); + TC_LOG_INFO("network.soap", "Client used invalid username '{}'", soap->userid); return 401; } if (!AccountMgr::CheckPassword(accountId, soap->passwd)) { - TC_LOG_INFO("network.soap", "Invalid password for account '%s'", soap->userid); + TC_LOG_INFO("network.soap", "Invalid password for account '{}'", soap->userid); return 401; } if (AccountMgr::GetSecurity(accountId, realm.Id.Realm) < SEC_ADMINISTRATOR) { - TC_LOG_INFO("network.soap", "%s's gmlevel is too low", soap->userid); + TC_LOG_INFO("network.soap", "{}'s gmlevel is too low", soap->userid); return 403; } if (!command || !*command) return soap_sender_fault(soap, "Command can not be empty", "The supplied command was an empty string"); - TC_LOG_INFO("network.soap", "Received command '%s'", command); + TC_LOG_INFO("network.soap", "Received command '{}'", command); SOAPCommand connection; // commands are executed in the world thread. We have to wait for them to be completed |