From 487dccfddd6c14ad2c43bcc77af1a61c81e735f9 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 11 Sep 2016 21:31:36 -0700 Subject: [PATCH] Remove format lib all together it was a relic of spdlog anyway --- common/eqemu_logsys.h | 8 -------- common/net/daybreak_connection.cpp | 10 +++++----- common/net/eqstream.cpp | 6 +++--- common/net/packet.cpp | 14 +++++++------- libs/CMakeLists.txt | 1 - loginserver/CMakeLists.txt | 2 +- loginserver/client_manager.cpp | 6 +++--- ucs/CMakeLists.txt | 2 +- ucs/clientlist.cpp | 5 ++--- 9 files changed, 22 insertions(+), 32 deletions(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 2cfe00eff..ae2cf180d 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -19,7 +19,6 @@ #ifndef EQEMU_LOGSYS_H #define EQEMU_LOGSYS_H -#include #include #include #include @@ -158,13 +157,6 @@ public: void SetCurrentTimeStamp(char* time_stamp); /* Used in file logs to prepend a timestamp entry for logs */ void StartFileLogs(const std::string &log_name = ""); /* Used to declare the processes file log and to keep it open for later use */ - template - void OutF(Logs::DebugLevel debug_level, uint16 log_category, const char *fmt, const Args&... args) - { - std::string log_str = fmt::format(fmt, args...); - Out(debug_level, log_category, log_str); - } - /* LogSettings Struct diff --git a/common/net/daybreak_connection.cpp b/common/net/daybreak_connection.cpp index 7c1104bce..96578d472 100644 --- a/common/net/daybreak_connection.cpp +++ b/common/net/daybreak_connection.cpp @@ -165,7 +165,7 @@ void EQ::Net::DaybreakConnectionManager::ProcessResend() void EQ::Net::DaybreakConnectionManager::ProcessPacket(const std::string &endpoint, int port, const char *data, size_t size) { if (size < DaybreakHeader::size()) { - Log.OutF(Logs::Detail, Logs::Netcode, "Packet of size {0} which is less than {1}", size, DaybreakHeader::size()); + Log.Out(Logs::Detail, Logs::Netcode, "Packet of size %u which is less than %u", size, DaybreakHeader::size()); return; } @@ -195,7 +195,7 @@ void EQ::Net::DaybreakConnectionManager::ProcessPacket(const std::string &endpoi } } catch (std::exception &ex) { - Log.OutF(Logs::Detail, Logs::Netcode, "Error processing packet: {0}", ex.what()); + Log.Out(Logs::Detail, Logs::Netcode, "Error processing packet: %s", ex.what()); } } @@ -341,7 +341,7 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p) } if (p.GetInt8(0) != 0) { - Log.OutF(Logs::Detail, Logs::Netcode, "Error parsing packet, did not start with a 0 frame, not a valid protocol packet."); + Log.Out(Logs::Detail, Logs::Netcode, "Error parsing packet, did not start with a 0 frame, not a valid protocol packet."); return; } @@ -352,7 +352,7 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p) if (PacketCanBeEncoded(p)) { if (!ValidateCRC(p)) { - Log.OutF(Logs::Detail, Logs::Netcode, "Tossed packet that failed CRC of type {0:#x}", p.Length() >= 2 ? p.GetInt8(1) : 0); + Log.Out(Logs::Detail, Logs::Netcode, "Tossed packet that failed CRC of type 0x%x", p.Length() >= 2 ? p.GetInt8(1) : 0); return; } @@ -664,7 +664,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(Packet &p) break; } default: - Log.OutF(Logs::Detail, Logs::Netcode, "Unhandled opcode {0:#x}", p.GetInt8(1)); + Log.Out(Logs::Detail, Logs::Netcode, "Unhandled opcode 0x%x", p.GetInt8(1)); break; } } diff --git a/common/net/eqstream.cpp b/common/net/eqstream.cpp index b2c9864d5..a6dc91ea8 100644 --- a/common/net/eqstream.cpp +++ b/common/net/eqstream.cpp @@ -48,7 +48,7 @@ void EQ::Net::EQStreamManager::DaybreakPacketRecv(std::shared_ptrsecond->RegisterPatch(pt.get()); patch = pt.get(); - Log.OutF(Logs::General, Logs::Debug, "Identified patch with name {0}", pt->GetName()); + Log.Out(Logs::General, Logs::Debug, "Identified patch with name %s", pt->GetName().c_str()); } } } @@ -59,7 +59,7 @@ void EQ::Net::EQStreamManager::DaybreakPacketRecv(std::shared_ptrDecode(&p, opcode, out); if (opcode == OP_Unknown) { - Log.OutF(Logs::General, Logs::Netcode, "Incoming packet was not handled because the opcode was not found.\n{0}", p.ToString()); + Log.Out(Logs::General, Logs::Netcode, "Incoming packet was not handled because the opcode was not found.\n%s", p.ToString().c_str()); } else { if (m_on_packet_recv) { @@ -68,7 +68,7 @@ void EQ::Net::EQStreamManager::DaybreakPacketRecv(std::shared_ptr -#include +#include #include void EQ::Net::Packet::PutInt8(size_t offset, int8_t value) @@ -290,12 +290,12 @@ std::string EQ::Net::Packet::ToString(size_t line_length) const char *data = (char*)Data(); for (i = 0; i < lines; ++i) { - ret += fmt::format("{:0>5x} |", i * line_length); + ret += StringFormat("%.5x |", i * line_length); std::string hex; std::string ascii; for (size_t j = 0; j < line_length; ++j) { - hex += fmt::format(" {:0>2x}", (uint8_t)data[(i * line_length) + j]); - ascii += fmt::format("{}", ToSafePrint(data[(i * line_length) + j])); + hex += StringFormat(" %.2x", (uint8_t)data[(i * line_length) + j]); + ascii += StringFormat("%c", ToSafePrint(data[(i * line_length) + j])); } ret += hex; @@ -305,7 +305,7 @@ std::string EQ::Net::Packet::ToString(size_t line_length) const } if (Length() % line_length > 0) { - ret += fmt::format("{:0>5x} |", i * line_length); + ret += StringFormat("%.5x |", i * line_length); size_t non_blank_count = Length() % line_length; size_t blank_count = line_length - non_blank_count; @@ -313,8 +313,8 @@ std::string EQ::Net::Packet::ToString(size_t line_length) const std::string ascii; for (size_t j = 0; j < non_blank_count; ++j) { - hex += fmt::format(" {:0>2x}", (uint8_t)data[(i * line_length) + j]); - ascii += fmt::format("{}", ToSafePrint(data[(i * line_length) + j])); + hex += StringFormat(" %.2x", (uint8_t)data[(i * line_length) + j]); + ascii += StringFormat("%x", ToSafePrint(data[(i * line_length) + j])); } for (size_t j = 0; j < blank_count; ++j) { diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index cb5a25998..35f3e38a9 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -3,4 +3,3 @@ IF(EQEMU_BUILD_LUA) ENDIF(EQEMU_BUILD_LUA) ADD_SUBDIRECTORY(libuv) -ADD_SUBDIRECTORY(format) \ No newline at end of file diff --git a/loginserver/CMakeLists.txt b/loginserver/CMakeLists.txt index f239e6ce2..73f5a07ef 100644 --- a/loginserver/CMakeLists.txt +++ b/loginserver/CMakeLists.txt @@ -41,7 +41,7 @@ ADD_EXECUTABLE(loginserver ${eqlogin_sources} ${eqlogin_headers}) INSTALL(TARGETS loginserver RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -TARGET_LINK_LIBRARIES(loginserver common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY} libuv fmt) +TARGET_LINK_LIBRARIES(loginserver common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY} libuv) IF(WIN32) TARGET_LINK_LIBRARIES(loginserver "ws2_32" "psapi" "iphlpapi" "userenv") diff --git a/loginserver/client_manager.cpp b/loginserver/client_manager.cpp index 5ecc1f9e9..7cb50e1cd 100644 --- a/loginserver/client_manager.cpp +++ b/loginserver/client_manager.cpp @@ -52,14 +52,14 @@ ClientManager::~ClientManager() void ClientManager::HandleNewConnectionTitanium(std::shared_ptr connection) { - Log.OutF(Logs::General, Logs::Login_Server, "New Titanium client from {0}:{1}", connection->RemoteEndpoint(), connection->RemotePort()); + Log.Out(Logs::General, Logs::Login_Server, "New Titanium client from %s:%d", connection->RemoteEndpoint().c_str(), connection->RemotePort()); Client *c = new Client(connection, cv_titanium); clients.push_back(std::unique_ptr(c)); } void ClientManager::HandleNewConnectionSod(std::shared_ptr connection) { - Log.OutF(Logs::General, Logs::Login_Server, "New SoD client from {0}:{1}", connection->RemoteEndpoint(), connection->RemotePort()); + Log.Out(Logs::General, Logs::Login_Server, "New SoD client from %s:%d", connection->RemoteEndpoint().c_str(), connection->RemotePort()); Client *c = new Client(connection, cv_sod); clients.push_back(std::unique_ptr(c)); } @@ -67,7 +67,7 @@ void ClientManager::HandleNewConnectionSod(std::shared_ptr co void ClientManager::HandleConnectionChange(std::shared_ptr connection, EQ::Net::DbProtocolStatus old_status, EQ::Net::DbProtocolStatus new_status) { if (new_status == EQ::Net::DbProtocolStatus::StatusDisconnected) { - Log.OutF(Logs::General, Logs::Login_Server, "Client has been disconnected, removing {0}:{1}", connection->RemoteEndpoint(), connection->RemotePort()); + Log.Out(Logs::General, Logs::Login_Server, "Client has been disconnected, removing %s:%d", connection->RemoteEndpoint().c_str(), connection->RemotePort()); auto iter = clients.begin(); while (iter != clients.end()) { if ((*iter)->GetConnection() == connection) { diff --git a/ucs/CMakeLists.txt b/ucs/CMakeLists.txt index 07415afd2..0433af812 100644 --- a/ucs/CMakeLists.txt +++ b/ucs/CMakeLists.txt @@ -23,7 +23,7 @@ INSTALL(TARGETS ucs RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) ADD_DEFINITIONS(-DUCS) -TARGET_LINK_LIBRARIES(ucs common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY} libuv fmt) +TARGET_LINK_LIBRARIES(ucs common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY} libuv) IF(WIN32) TARGET_LINK_LIBRARIES(ucs "ws2_32" "psapi" "iphlpapi" "userenv") diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index a7ad95d50..a0edb7797 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -2114,7 +2114,7 @@ Client *Clientlist::IsCharacterOnline(std::string CharacterName) { void Clientlist::HandleNewConnection(std::shared_ptr connection) { - Log.OutF(Logs::Detail, Logs::UCS_Server, "New Client UDP connection from {0}:{1}", connection->RemoteEndpoint(), connection->RemotePort()); + Log.Out(Logs::Detail, Logs::UCS_Server, "New Client UDP connection from %s:%d", connection->RemoteEndpoint().c_str(), connection->RemotePort()); Client *c = new Client(connection); ClientChatConnections.push_back(std::unique_ptr(c)); } @@ -2122,7 +2122,7 @@ void Clientlist::HandleNewConnection(std::shared_ptr connecti void Clientlist::HandleConnectionChange(std::shared_ptr connection, EQ::Net::DbProtocolStatus old_status, EQ::Net::DbProtocolStatus new_status) { if (new_status == EQ::Net::DbProtocolStatus::StatusDisconnected) { - Log.OutF(Logs::Detail, Logs::UCS_Server, "Client connection from {0}:{1} closed.", connection->RemoteEndpoint(), connection->RemotePort()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Client connection from %s:%d closed.", connection->RemoteEndpoint().c_str(), connection->RemotePort()); auto iter = ClientChatConnections.begin(); while (iter != ClientChatConnections.end()) { if ((*iter)->ClientStream == connection) { @@ -2139,7 +2139,6 @@ void Clientlist::HandlePacket(std::shared_ptr connection, Emu auto iter = ClientChatConnections.begin(); while (iter != ClientChatConnections.end()) { if ((*iter)->ClientStream == connection) { - Log.OutF(Logs::General, Logs::UCS_Server, "{0}", p.ToString()); EQApplicationPacket app(opcode, (unsigned char*)p.Data(), (uint32)p.Length()); Process((*iter).get(), &app); return;