diff --git a/src/api/main.cpp b/src/api/main.cpp index f287fc08..467797a4 100644 --- a/src/api/main.cpp +++ b/src/api/main.cpp @@ -63,7 +63,7 @@ void reloadConfig() void print_request_info( shared_ptr< HttpServer::Request > request ) { - Logger::info( "Request from " + request->remote_endpoint_address + " (" + request->path + ")" ); + Logger::info( "Request from {0} ({1})", request->remote_endpoint_address, request->path ); } bool loadSettings( int32_t argc, char* argv[] ) @@ -72,7 +72,7 @@ bool loadSettings( int32_t argc, char* argv[] ) if( !m_pConfig->loadConfig( configPath ) ) { - Logger::fatal( "Error loading config " + configPath ); + Logger::fatal( "Error loading config {0}", configPath ); Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." ); return false; } @@ -134,7 +134,7 @@ bool loadSettings( int32_t argc, char* argv[] ) } catch( ... ) { - Logger::error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" ); + Logger::error( "Error parsing argument: {0} value: {1}\n", arg, val ); Logger::error( "Usage: \n" ); } } @@ -144,7 +144,7 @@ bool loadSettings( int32_t argc, char* argv[] ) if( !g_exdDataGen.init( dataPath ) ) { Logger::fatal( "Error setting up generated EXD data. Make sure that DataPath is set correctly in config.ini" ); - Logger::fatal( "DataPath: " + dataPath ); + Logger::fatal( "DataPath: {0}", dataPath ); return false; } @@ -167,7 +167,7 @@ bool loadSettings( int32_t argc, char* argv[] ) m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) ) ); server.config.address = m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" ); - Logger::info( "Database: Connected to " + info.host + ":" + std::to_string( info.port ) ); + Logger::info( "Database: Connected to {0}:{1}", info.host, info.port ); return true; } @@ -767,7 +767,7 @@ int main( int argc, char* argv[] ) server.start(); } ); - Logger::info( "API server running on " + m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" ) + ":" + + Logger::info( "API server running on {0}:{1}", m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" ), m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) ); //Wait for server to start so that the client can connect diff --git a/src/dbm/main.cpp b/src/dbm/main.cpp index b82dde0c..dacf13f5 100644 --- a/src/dbm/main.cpp +++ b/src/dbm/main.cpp @@ -180,11 +180,11 @@ int main( int32_t argc, char* argv[] ) } else { - Logger::fatal( "Not a valid mode: " + mode + " !" ); + Logger::fatal( "Not a valid mode: {0} !", mode ); return 1; } - Logger::info( "Launching in " + mode + " mode..." ); + Logger::info( "Launching in {0} mode...", mode ); if( !dbm.connect() ) { diff --git a/src/lobby/ServerLobby.cpp b/src/lobby/ServerLobby.cpp index c0ad8ebf..1efaf3d0 100644 --- a/src/lobby/ServerLobby.cpp +++ b/src/lobby/ServerLobby.cpp @@ -83,11 +83,11 @@ namespace Sapphire bool ServerLobby::loadSettings( int32_t argc, char* argv[] ) { - Logger::info( "Loading config " + m_configPath ); + Logger::info( "Loading config {0}", m_configPath ); if( !m_pConfig->loadConfig( m_configPath ) ) { - Logger::fatal( "Error loading config " + m_configPath ); + Logger::fatal( "Error loading config {0}", m_configPath ); Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." ); return false; } @@ -125,7 +125,7 @@ namespace Sapphire } catch( ... ) { - Logger::error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" ); + Logger::error( "Error parsing argument: {0} value: {1}\n", arg, val ); Logger::error( "Usage: \n" ); } } diff --git a/src/world/Inventory/ItemContainer.cpp b/src/world/Inventory/ItemContainer.cpp index 490269c7..3dd41846 100644 --- a/src/world/Inventory/ItemContainer.cpp +++ b/src/world/Inventory/ItemContainer.cpp @@ -48,11 +48,11 @@ void Sapphire::ItemContainer::removeItem( uint16_t slotId, bool removeFromDb ) m_itemMap.erase( it ); - Logger::debug( "Dropped item from slot " + std::to_string( slotId ) ); + Logger::debug( "Dropped item from slot {0}", slotId ); } else { - Logger::debug( "Item could not be dropped from slot " + std::to_string( slotId ) ); + Logger::debug( "Item could not be dropped from slot {0}", slotId ); } } @@ -83,7 +83,7 @@ Sapphire::ItemPtr Sapphire::ItemContainer::getItem( uint16_t slotId ) if( ( slotId > m_size ) ) { - Logger::error( "Slot out of range " + std::to_string( slotId ) ); + Logger::error( "Slot out of range {0}", slotId ); return nullptr; } diff --git a/src/world/Manager/DebugCommandMgr.cpp b/src/world/Manager/DebugCommandMgr.cpp index 63b3d53a..8d6d16e1 100644 --- a/src/world/Manager/DebugCommandMgr.cpp +++ b/src/world/Manager/DebugCommandMgr.cpp @@ -159,8 +159,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player& if( command->getName().length() + 1 + pos + 1 < strlen( data ) ) params = std::string( data + command->getName().length() + 1 + pos + 1 ); - Logger::debug( "[" + std::to_string( player.getId() ) + "] " + - "subCommand " + subCommand + " params: " + params ); + Logger::debug( "[{0}] subCommand: {1} params: {1}", player.getId(), subCommand, params ); if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( params != "" ) ) { @@ -533,9 +532,7 @@ void Sapphire::World::Manager::DebugCommandMgr::get( char* data, Entity::Player& if( command->getName().length() + 1 + pos + 1 < strlen( data ) ) params = std::string( data + command->getName().length() + 1 + pos + 1 ); - Logger::debug( "[" + std::to_string( player.getId() ) + "] " + - "subCommand " + subCommand + " params: " + params ); - + Logger::debug( "[{0}] subCommand: {1} params: {2}", player.getId(), subCommand, params ); if( ( subCommand == "pos" ) ) { @@ -708,8 +705,7 @@ void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Play if( command->getName().length() + 1 + pos + 1 < strlen( data ) ) params = std::string( data + command->getName().length() + 1 + pos + 1 ); - Logger::debug( "[" + std::to_string( player.getId() ) + "] " + - "subCommand " + subCommand + " params: " + params ); + Logger::debug( "[{0}] subCommand: {1} params: {2}", player.getId(), subCommand, params ); if( subCommand == "unload" ) { diff --git a/src/world/Manager/HousingMgr.cpp b/src/world/Manager/HousingMgr.cpp index 5fda5ef4..bf2ff370 100644 --- a/src/world/Manager/HousingMgr.cpp +++ b/src/world/Manager/HousingMgr.cpp @@ -94,12 +94,12 @@ bool Sapphire::World::Manager::HousingMgr::init() if( landSet.second.size() != 60 ) { - Logger::fatal( "LandSet " + std::to_string( landSet.first ) + " is missing land entries. Only have " + std::to_string( count ) + " land entries." ); + Logger::fatal( "LandSet {0} is missing land entries. Only have {1} land entries.", landSet.first, count ); return false; } } - Logger::info( "HousingMgr: Cached " + std::to_string( houseCount ) + " houses" ); + Logger::info( "HousingMgr: Cached {0} houses", houseCount ); ///// @@ -158,7 +158,7 @@ bool Sapphire::World::Manager::HousingMgr::loadEstateInventories() itemCount++; } - Logger::debug( "HousingMgr: Loaded " + std::to_string( itemCount ) + " inventory items" ); + Logger::debug( "HousingMgr: Loaded {0} inventory items", itemCount ); return true; } @@ -217,8 +217,8 @@ void Sapphire::World::Manager::HousingMgr::initLandCache() break; default: // this should never ever happen, if it does the db is fucked - Logger::error( "HousingMgr: Plot " + std::to_string( entry.m_landId ) + " in landset " + std::to_string( entry.m_landSetId ) + - " has an invalid land size, defaulting to cottage." ); + Logger::error( "HousingMgr: Plot {0} in landset {1} has an invalid land size, defaulting to cottage.", + entry.m_landId, entry.m_landSetId ); entry.m_maxPlacedExternalItems = 20; entry.m_maxPlacedInternalItems = 200; break; @@ -913,7 +913,7 @@ void Sapphire::World::Manager::HousingMgr::updateHouseModels( Sapphire::HousePtr } else { - Logger::error( "Plot " + std::to_string( house->getLandIdent().landId ) + " has an invalid inventory configuration for outdoor appearance." ); + Logger::error( "Plot {0} has an invalid inventory configuration for outdoor appearance.", house->getLandIdent().landId ); } auto intContainer = containers.find( static_cast< uint16_t >( InventoryType::HousingInteriorAppearance ) ); @@ -927,7 +927,7 @@ void Sapphire::World::Manager::HousingMgr::updateHouseModels( Sapphire::HousePtr } else { - Logger::error( "Plot " + std::to_string( house->getLandIdent().landId ) + " has an invalid inventory configuration for indoor appearance." ); + Logger::error( "Plot {0} has an invalid inventory configuration for indoor appearance.", house->getLandIdent().landId ); } } diff --git a/src/world/Manager/TerritoryMgr.cpp b/src/world/Manager/TerritoryMgr.cpp index 9e260c61..1c9ba245 100644 --- a/src/world/Manager/TerritoryMgr.cpp +++ b/src/world/Manager/TerritoryMgr.cpp @@ -162,12 +162,14 @@ bool Sapphire::World::Manager::TerritoryMgr::createDefaultTerritories() continue; uint32_t guid = getNextInstanceId(); - Logger::info( std::to_string( territoryTypeId ) + - "\t" + std::to_string( guid ) + - "\t" + std::to_string( territoryInfo->territoryIntendedUse ) + - "\t" + ( territoryInfo->name.length() <= 4 ? territoryInfo->name + "\t" : territoryInfo->name ) + - "\t" + ( isPrivateTerritory( territoryTypeId ) ? "PRIVATE" : "PUBLIC" ) + - "\t" + pPlaceName->name ); + + Logger::info( "{0}\t{1}\t{2}\t{3:<10}\t{4}\t{5}", + territoryTypeId, + guid, + territoryInfo->territoryIntendedUse, + territoryInfo->name, + ( isPrivateTerritory( territoryTypeId ) ? "PRIVATE" : "PUBLIC" ), + pPlaceName->name ); auto pZone = make_Zone( territoryTypeId, guid, territoryInfo->name, pPlaceName->name, framework() ); pZone->init(); @@ -205,13 +207,14 @@ bool Sapphire::World::Manager::TerritoryMgr::createHousingTerritories() for( wardNum = 0; wardNum < wardMaxNum; wardNum++ ) { uint32_t guid = getNextInstanceId(); - Logger::info( std::to_string( territoryTypeId ) + - "\t" + std::to_string( guid ) + - "\t" + std::to_string( territoryInfo->territoryIntendedUse ) + - "\t" + ( territoryInfo->name.length() <= 4 ? territoryInfo->name + "\t" : territoryInfo->name ) + - "\t" + "HOUSING" + - "\t" + pPlaceName->name + - "#" + std::to_string( wardNum ) ); + + Logger::info( "{0}\t{1}\t{2}\t{3:<10}\tHOUSING\t{4}#{5}", + territoryTypeId, + guid, + territoryInfo->territoryIntendedUse, + territoryInfo->name, + pPlaceName->name, + wardNum ); auto pHousingZone = make_HousingZone( wardNum, territoryTypeId, guid, territoryInfo->name, pPlaceName->name, framework() ); @@ -246,8 +249,7 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createTerritoryInstanc if( !pTeri || !pPlaceName ) return nullptr; - Logger::debug( - "Starting instance for territory: " + std::to_string( territoryTypeId ) + " (" + pPlaceName->name + ")" ); + Logger::debug( "Starting instance for territory: {0} ({1})", territoryTypeId, pPlaceName->name ); auto pZone = make_Zone( territoryTypeId, getNextInstanceId(), pTeri->name, pPlaceName->name, framework() ); pZone->init(); @@ -280,8 +282,7 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createInstanceContent( if( !pTeri || pInstanceContent->name.empty() ) return nullptr; - Logger::debug( "Starting instance for InstanceContent id: " + std::to_string( instanceContentId ) + - " (" + pInstanceContent->name + ")" ); + Logger::debug( "Starting instance for InstanceContent id: {0} ({1})", instanceContentId, pInstanceContent->name ); auto pZone = make_InstanceContent( pInstanceContent, pContentFinderCondition->territoryType, getNextInstanceId(), pTeri->name, pInstanceContent->name, instanceContentId, framework() ); @@ -471,8 +472,7 @@ void Sapphire::World::Manager::TerritoryMgr::updateTerritoryInstances( uint32_t // todo: make this timeout configurable, though should be pretty relaxed in any case if( diff > 60 ) { - Logger::info( "Removing HousingInteriorTerritory#" + - std::to_string( zone->getGuId() ) + " - has been inactive for 60 seconds" ); + Logger::info( "Removing HousingInteriorTerritory#{0} - has been inactive for 60 seconds", zone->getGuId() ); // remove zone from maps m_zoneSet.erase( zone ); diff --git a/src/world/Network/GameConnection.cpp b/src/world/Network/GameConnection.cpp index 57e336f4..8e70db70 100644 --- a/src/world/Network/GameConnection.cpp +++ b/src/world/Network/GameConnection.cpp @@ -141,7 +141,7 @@ void Sapphire::Network::GameConnection::OnAccept( const std::string& host, uint1 { GameConnectionPtr connection( new GameConnection( m_hive, m_pAcceptor, m_pFw ) ); m_pAcceptor->Accept( connection ); - Logger::info( "Connect from " + m_socket.remote_endpoint().address().to_string() ); + Logger::info( "Connect from {0}", m_socket.remote_endpoint().address().to_string() ); } @@ -196,7 +196,7 @@ void Sapphire::Network::GameConnection::OnRecv( std::vector< uint8_t >& buffer ) void Sapphire::Network::GameConnection::OnError( const asio::error_code& error ) { - Logger::debug( "GameConnection ERROR: " + error.message() ); + Logger::debug( "GameConnection ERROR: {0}", error.message() ); } void Sapphire::Network::GameConnection::queueInPacket( Sapphire::Network::Packets::FFXIVARR_PACKET_RAW inPacket ) @@ -214,25 +214,21 @@ void Sapphire::Network::GameConnection::handleZonePacket( Sapphire::Network::Pac uint16_t opcode = *reinterpret_cast< uint16_t* >( &pPacket.data[ 0x02 ] ); auto it = m_zoneHandlerMap.find( opcode ); - std::string sessionStr = "[" + std::to_string( m_pSession->getId() ) + "]"; - if( it != m_zoneHandlerMap.end() ) { auto itStr = m_zoneHandlerStrMap.find( opcode ); std::string name = itStr != m_zoneHandlerStrMap.end() ? itStr->second : "unknown"; // dont display packet notification if it is a ping or pos update, don't want the spam if( opcode != PingHandler && opcode != UpdatePositionHandler ) - Logger::debug( sessionStr + " Handling Zone IPC : " + name + "( " + - Util::intToHexString( static_cast< uint32_t >( opcode ), 4 ) + " )" ); + Logger::debug( "[{0}] Handling Zone IPC : {1} ( {2:X} )", m_pSession->getId(), name, opcode ); ( this->*( it->second ) )( m_pFw, pPacket, *m_pSession->getPlayer() ); } else { - Logger::debug( sessionStr + " Undefined Zone IPC : Unknown ( " + - Util::intToHexString( static_cast< uint32_t >( opcode ), 4 ) + " )" ); - Logger::debug( "Dump:\n" + Util::binaryToHexDump( const_cast< uint8_t* >( &pPacket.data[ 0 ] ), - pPacket.segHdr.size ) ); + Logger::debug( "[{0}] Undefined Zone IPC : Unknown ( {1:X} )", m_pSession->getId(), opcode ); + Logger::debug( "Dump: {0}", Util::binaryToHexDump( const_cast< uint8_t* >( &pPacket.data[ 0 ] ), + pPacket.segHdr.size ) ); } } @@ -241,23 +237,19 @@ void Sapphire::Network::GameConnection::handleChatPacket( Sapphire::Network::Pac uint16_t opcode = *reinterpret_cast< uint16_t* >( &pPacket.data[ 0x02 ] ); auto it = m_chatHandlerMap.find( opcode ); - std::string sessionStr = "[" + std::to_string( m_pSession->getId() ) + "]"; - if( it != m_chatHandlerMap.end() ) { auto itStr = m_chatHandlerStrMap.find( opcode ); std::string name = itStr != m_chatHandlerStrMap.end() ? itStr->second : "unknown"; // dont display packet notification if it is a ping or pos update, don't want the spam - Logger::debug( sessionStr + " Handling Chat IPC : " + name + "( " + - Util::intToHexString( static_cast< uint32_t >( opcode ), 4 ) + " )" ); + Logger::debug( "[{0}] Handling Chat IPC : {1} ( {2:X} )", m_pSession->getId(), name, opcode ); ( this->*( it->second ) )( m_pFw, pPacket, *m_pSession->getPlayer() ); } else { - Logger::debug( sessionStr + " Undefined Chat IPC : Unknown ( " + - Util::intToHexString( static_cast< uint32_t >( opcode ), 4 ) + " )" ); + Logger::debug( "[{0}] Undefined Chat IPC : Unknown ( {1:X} )", m_pSession->getId(), opcode ); } } @@ -413,7 +405,7 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network:: if( !session ) { - Logger::info( "[" + std::string( id ) + "] Session not registered, creating" ); + Logger::info( "[{0}] Session not registered, creating", id ); // return; if( !pServerZone->createSession( playerId ) ) { @@ -425,7 +417,7 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network:: //TODO: Catch more things in lobby and send real errors else if( !session->isValid() || ( session->getPlayer() && session->getPlayer()->getLastPing() != 0 ) ) { - Logger::error( "[" + std::string( id ) + "] Session INVALID, disconnecting" ); + Logger::error( "[{0}] Session INVALID, disconnecting", id ); Disconnect(); return; } @@ -445,7 +437,7 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network:: auto pe1 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 ); *( unsigned int* ) ( &pe1->data()[ 0 ] ) = playerId; sendSinglePacket( pe1 ); - Logger::info( "[" + std::string( id ) + "] Setting session for zone connection" ); + Logger::info( "[{0}] Setting session for zone connection", id ); session->setZoneConnection( pCon ); } // chat connection, assinging it to the session @@ -459,7 +451,7 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network:: *( unsigned short* ) ( &pe3->data()[ 2 ] ) = 0x02; sendSinglePacket( pe3 ); - Logger::info( "[" + std::string( id ) + "] Setting session for chat connection" ); + Logger::info( "[{0}] Setting session for chat connection", id ); session->setChatConnection( pCon ); } diff --git a/src/world/Network/Handlers/ClientTriggerHandler.cpp b/src/world/Network/Handlers/ClientTriggerHandler.cpp index d2752009..52d6032b 100644 --- a/src/world/Network/Handlers/ClientTriggerHandler.cpp +++ b/src/world/Network/Handlers/ClientTriggerHandler.cpp @@ -79,12 +79,8 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw, const auto param4 = packet.data().param4; const auto param5 = packet.data().param5; - Logger::debug( "[" + std::to_string( m_pSession->getId() ) + "] Incoming action: " + - Util::intToHexString( static_cast< uint32_t >( commandId & 0xFFFF ), 4 ) + - "\nparam1: " + Util::intToHexString( static_cast< uint64_t >( param1 & 0xFFFFFFFFFFFFFFF ), 16 ) + - "\nparam2: " + Util::intToHexString( static_cast< uint32_t >( param2 & 0xFFFFFFFF ), 8 ) + - "\nparam3: " + Util::intToHexString( static_cast< uint64_t >( param3 & 0xFFFFFFFFFFFFFFF ), 16 ) - ); + Logger::debug( "[{0}] Incoming action: {1:#04X}\nparam1: {2:#016X}\nparam2: {3:#08X}\nparam3: {4:#016X}", + m_pSession->getId(), param1, param2, param3 ); //g_log.Log(LoggingSeverity::debug, "[" + std::to_string(m_pSession->getId()) + "] " + pInPacket->toString()); @@ -494,8 +490,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw, default: { - Logger::debug( "[" + std::to_string( m_pSession->getId() ) + "] Unhandled action: " + - Util::intToHexString( static_cast< uint32_t >( commandId & 0xFFFF ), 4 ) ); + Logger::debug( "[{0}] Unhandled action: {1:#04X}", m_pSession->getId(), commandId ); break; } } diff --git a/src/world/Network/Handlers/GMCommandHandlers.cpp b/src/world/Network/Handlers/GMCommandHandlers.cpp index 2cbb3543..980f3008 100644 --- a/src/world/Network/Handlers/GMCommandHandlers.cpp +++ b/src/world/Network/Handlers/GMCommandHandlers.cpp @@ -101,10 +101,9 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw, const auto param4 = packet.data().param4; const auto target = packet.data().target; - Logger::debug( player.getName() + " used GM1 commandId: " + std::to_string( commandId ) + - ", params: " + std::to_string( param1 ) + ", " + - std::to_string( param2 ) + ", " + std::to_string( param3 ) + ", " + std::to_string( param4 ) + - ", target: " + std::to_string( target ) ); + Logger::info( "{0} used GM1 commandId: {1}, params: {2}, {3}, {4}, {5}, target: {6}", + player.getName(), commandId, + param1, param2, param3, param4, target ); Sapphire::Entity::ActorPtr targetActor; @@ -563,10 +562,8 @@ void Sapphire::Network::GameConnection::gm2Handler( FrameworkPtr pFw, const auto param4 = packet.data().param4; const auto target = std::string( packet.data().target ); - Logger::debug( player.getName() + " used GM2 commandId: " + std::to_string( commandId ) + - ", params: " + std::to_string( param1 ) + ", " + - std::to_string( param2 ) + ", " + std::to_string( param3 ) + ", " + std::to_string( param4 ) + - ", target: " + target ); + Logger::debug( "{0} used GM2 commandId: {1}, params: {2}, {3}, {4}, {5}, target: {6}", + player.getName(), commandId, param1, param2, param3, param4, target ); auto targetSession = pServerZone->getSession( target ); Sapphire::Entity::CharaPtr targetActor; diff --git a/src/world/Network/Handlers/InventoryHandler.cpp b/src/world/Network/Handlers/InventoryHandler.cpp index b4f2002f..ecaf1a29 100644 --- a/src/world/Network/Handlers/InventoryHandler.cpp +++ b/src/world/Network/Handlers/InventoryHandler.cpp @@ -42,7 +42,7 @@ void Sapphire::Network::GameConnection::inventoryModifyHandler( FrameworkPtr pFw ackPacket->data().type = 7; player.queuePacket( ackPacket ); - Logger::debug( "InventoryAction: " + std::to_string( action ) ); + Logger::debug( "InventoryAction: {0}", action ); // TODO: other inventory operations need to be implemented switch( action ) diff --git a/src/world/Network/Handlers/PacketHandlers.cpp b/src/world/Network/Handlers/PacketHandlers.cpp index d737bf8a..c87002b5 100644 --- a/src/world/Network/Handlers/PacketHandlers.cpp +++ b/src/world/Network/Handlers/PacketHandlers.cpp @@ -117,7 +117,7 @@ void Sapphire::Network::GameConnection::reqExamineSearchCommentHandler( Framewor auto targetId = *reinterpret_cast< const uint32_t* >( &inPacket.data[ 0x10 ] ); auto pSession = pFw->get< World::ServerMgr >()->getSession( targetId ); - Logger::debug( std::to_string( targetId ) ); + Logger::debug( "reqExamineSearchCommentHandler: {0}", targetId ); if( pSession ) { @@ -145,7 +145,7 @@ void Sapphire::Network::GameConnection::reqExamineFcInfo( FrameworkPtr pFw, auto targetId = *reinterpret_cast< const uint32_t* >( &inPacket.data[ 0x18 ] ); auto pSession = pFw->get< World::ServerMgr >()->getSession( targetId ); - Logger::debug( std::to_string( targetId ) ); + Logger::debug( "reqExamineFcInfo: {0}", targetId ); if( pSession ) { diff --git a/src/world/Script/ScriptLoader.cpp b/src/world/Script/ScriptLoader.cpp index 4f5e7d64..f670c05c 100644 --- a/src/world/Script/ScriptLoader.cpp +++ b/src/world/Script/ScriptLoader.cpp @@ -48,7 +48,7 @@ Sapphire::Scripting::ScriptInfo* Sapphire::Scripting::ScriptLoader::loadModule( if( isModuleLoaded( f.stem().string() ) ) { - Logger::error( "Unable to load module '" + f.stem().string() + "' as it is already loaded" ); + Logger::error( "Unable to load module '{0}' as it is already loaded", f.stem().string() ); return nullptr; } @@ -63,7 +63,7 @@ Sapphire::Scripting::ScriptInfo* Sapphire::Scripting::ScriptLoader::loadModule( } catch( const fs::filesystem_error& err ) { - Logger::error( "Error copying file to cache: " + err.code().message() ); + Logger::error( "Error copying file to cache: {0}", err.code().message() ); return nullptr; } @@ -77,12 +77,12 @@ Sapphire::Scripting::ScriptInfo* Sapphire::Scripting::ScriptLoader::loadModule( if( !handle ) { - Logger::error( "Failed to load module from: " + path ); + Logger::error( "Failed to load module from: {0}", path ); return nullptr; } - Logger::debug( "Loaded module '" + f.filename().string() ); + Logger::debug( "Loaded module: {0}", f.filename().string() ); auto info = new ScriptInfo; info->handle = handle; @@ -140,7 +140,7 @@ bool Sapphire::Scripting::ScriptLoader::unloadScript( ModuleHandle handle ) return true; } - Logger::error( "failed to unload module: " + info->library_name ); + Logger::error( "failed to unload module: {0}", info->library_name ); return false; } diff --git a/src/world/Script/ScriptMgr.cpp b/src/world/Script/ScriptMgr.cpp index 68b34b24..c3088cad 100644 --- a/src/world/Script/ScriptMgr.cpp +++ b/src/world/Script/ScriptMgr.cpp @@ -55,8 +55,7 @@ bool Sapphire::Scripting::ScriptMgr::init() if( !status ) { - Logger::error( std::string( __func__ ) + - ": failed to load scripts, the server will not function correctly without scripts loaded." ); + Logger::error( "ScriptMgr: failed to load scripts, the server will not function correctly without scripts loaded." ); return false; } @@ -73,8 +72,7 @@ bool Sapphire::Scripting::ScriptMgr::init() scriptsLoaded++; } - Logger::info( - "ScriptMgr: Loaded " + std::to_string( scriptsLoaded ) + "/" + std::to_string( scriptsFound ) + " modules" ); + Logger::info( "ScriptMgr: Loaded {0}/{1} modules", scriptsLoaded, scriptsFound ); watchDirectories(); @@ -104,13 +102,13 @@ void Sapphire::Scripting::ScriptMgr::watchDirectories() { if( m_nativeScriptMgr->isModuleLoaded( path.stem().string() ) ) { - Logger::debug( "Reloading changed script: " + path.stem().string() ); + Logger::debug( "Reloading changed script: {0}", path.stem().string() ); m_nativeScriptMgr->queueScriptReload( path.stem().string() ); } else { - Logger::debug( "Loading new script: " + path.stem().string() ); + Logger::debug( "Loading new script: {0}", path.stem().string() ); m_nativeScriptMgr->loadScript( path.string() ); } @@ -121,7 +119,7 @@ void Sapphire::Scripting::ScriptMgr::watchDirectories() bool Sapphire::Scripting::ScriptMgr::loadDir( const std::string& dirname, std::set< std::string >& files, const std::string& ext ) { - Logger::info( "ScriptMgr: loading scripts from " + dirname ); + Logger::info( "ScriptMgr: loading scripts from: {0}", dirname ); if( !fs::exists( dirname ) ) { diff --git a/src/world/Territory/Housing/HousingInteriorTerritory.cpp b/src/world/Territory/Housing/HousingInteriorTerritory.cpp index 6bef748b..2ef529c8 100644 --- a/src/world/Territory/Housing/HousingInteriorTerritory.cpp +++ b/src/world/Territory/Housing/HousingInteriorTerritory.cpp @@ -54,9 +54,9 @@ bool Sapphire::World::Territory::Housing::HousingInteriorTerritory::init() void Sapphire::World::Territory::Housing::HousingInteriorTerritory::onPlayerZoneIn( Entity::Player& player ) { auto pHousingMgr = m_pFw->get< HousingMgr >(); - Logger::debug( - "HousingInteriorTerritory::onPlayerZoneIn: Zone#" + std::to_string( getGuId() ) + "|" + std::to_string( getTerritoryTypeId() ) + - ", Entity#" + std::to_string( player.getId() ) ); + + Logger::debug( "HousingInteriorTerritory::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}", + getGuId(), getTerritoryTypeId(), player.getId() ); auto indoorInitPacket = makeZonePacket< Server::FFXIVIpcHousingIndoorInitialize >( player.getId() ); indoorInitPacket->data().u1 = 0; diff --git a/src/world/Territory/HousingZone.cpp b/src/world/Territory/HousingZone.cpp index 9f79defa..793f8c8a 100644 --- a/src/world/Territory/HousingZone.cpp +++ b/src/world/Territory/HousingZone.cpp @@ -121,7 +121,7 @@ bool Sapphire::HousingZone::init() auto landSetCache = landCache.find( m_landSetId ); if( landSetCache == landCache.end() ) { - Logger::fatal( "LandSet " + std::to_string( m_landSetId ) + " is missing from the land cache." ); + Logger::fatal( "LandSet {0} is missing from the land cache.", m_landSetId ); return false; } @@ -157,9 +157,8 @@ Sapphire::HousingZone::~HousingZone() = default; void Sapphire::HousingZone::onPlayerZoneIn( Entity::Player& player ) { - Logger::debug( - "HousingZone::onPlayerZoneIn: Zone#" + std::to_string( getGuId() ) + "|" + std::to_string( getTerritoryTypeId() ) + - ", Entity#" + std::to_string( player.getId() ) ); + Logger::debug( "HousingZone::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}", + getGuId(), getTerritoryTypeId(), player.getId() ); auto isInSubdivision = isPlayerSubInstance( player ) ? true : false; diff --git a/src/world/Territory/InstanceContent.cpp b/src/world/Territory/InstanceContent.cpp index cf1dab3f..6d636219 100644 --- a/src/world/Territory/InstanceContent.cpp +++ b/src/world/Territory/InstanceContent.cpp @@ -72,9 +72,8 @@ Sapphire::Data::ExdDataGenerated::InstanceContentPtr Sapphire::InstanceContent:: void Sapphire::InstanceContent::onPlayerZoneIn( Entity::Player& player ) { - Logger::debug( "InstanceContent::onPlayerZoneIn: Zone#" + std::to_string( getGuId() ) + "|" - + std::to_string( getInstanceContentId() ) + - +", Entity#" + std::to_string( player.getId() ) ); + Logger::debug( "InstanceContent::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}", + getGuId(), getTerritoryTypeId(), player.getId() ); // mark player as "bound by duty" player.setStateFlag( PlayerStateFlag::BoundByDuty ); @@ -88,9 +87,8 @@ void Sapphire::InstanceContent::onPlayerZoneIn( Entity::Player& player ) void Sapphire::InstanceContent::onLeaveTerritory( Entity::Player& player ) { - Logger::debug( "InstanceContent::onLeaveTerritory: Zone#" + std::to_string( getGuId() ) + "|" - + std::to_string( getInstanceContentId() ) + - +", Entity#" + std::to_string( player.getId() ) ); + Logger::debug( "InstanceContent::onLeaveTerritory: Zone#{0}|{1}, Entity#{2}", + getGuId(), getTerritoryTypeId(), player.getId() ); sendDirectorClear( player ); player.setDirectorInitialized( false ); diff --git a/src/world/Territory/Zone.cpp b/src/world/Territory/Zone.cpp index 1d1090a0..154964f6 100644 --- a/src/world/Territory/Zone.cpp +++ b/src/world/Territory/Zone.cpp @@ -679,16 +679,12 @@ void Sapphire::Zone::updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell ) void Sapphire::Zone::onPlayerZoneIn( Entity::Player& player ) { - Logger::debug( - "Zone::onEnterTerritory: Zone#" + std::to_string( getGuId() ) + "|" + std::to_string( getTerritoryTypeId() ) + - + ", Entity#" + std::to_string( player.getId() ) ); + Logger::debug( "Zone::onEnterTerritory: Zone#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() ); } void Sapphire::Zone::onLeaveTerritory( Entity::Player& player ) { - Logger::debug( - "Zone::onLeaveTerritory: Zone#" + std::to_string( getGuId() ) + "|" + std::to_string( getTerritoryTypeId() ) + - + ", Entity#" + std::to_string( player.getId() ) ); + Logger::debug( "Zone::onLeaveTerritory: Zone#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() ); } void Sapphire::Zone::onUpdate( uint32_t currTime ) @@ -776,10 +772,8 @@ bool Sapphire::Zone::loadSpawnGroups() //Entity::SpawnGroup group; - Logger::debug( std::to_string( id ) + " " + - std::to_string( templateId ) + " " + - std::to_string( level ) + " " + - std::to_string( maxHp ) ); + + Logger::debug( "id: {0}, template: {1}, level: {2}, maxHp: {3}", id, templateId, level, maxHp ); }