mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-24 17:21:29 +00:00
Remove format lib all together it was a relic of spdlog anyway
This commit is contained in:
parent
7a9b07871e
commit
487dccfddd
@ -19,7 +19,6 @@
|
||||
#ifndef EQEMU_LOGSYS_H
|
||||
#define EQEMU_LOGSYS_H
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <stdio.h>
|
||||
@ -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 <typename... Args>
|
||||
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
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ void EQ::Net::EQStreamManager::DaybreakPacketRecv(std::shared_ptr<DaybreakConnec
|
||||
if (match == EQ::Patches::IdentityMatchSuccess) {
|
||||
iter->second->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_ptr<DaybreakConnec
|
||||
patch->Decode(&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<DaybreakConnec
|
||||
}
|
||||
}
|
||||
else {
|
||||
Log.OutF(Logs::General, Logs::Netcode, "Incoming packet was not handled because we don't have a patch set.\n{0}", p.ToString());
|
||||
Log.Out(Logs::General, Logs::Netcode, "Incoming packet was not handled because we don't have a patch set.\n%s", p.ToString().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#include "packet.h"
|
||||
#include <net/endian.h>
|
||||
#include <fmt/format.h>
|
||||
#include <string_util.h>
|
||||
#include <cctype>
|
||||
|
||||
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) {
|
||||
|
||||
@ -3,4 +3,3 @@ IF(EQEMU_BUILD_LUA)
|
||||
ENDIF(EQEMU_BUILD_LUA)
|
||||
|
||||
ADD_SUBDIRECTORY(libuv)
|
||||
ADD_SUBDIRECTORY(format)
|
||||
@ -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")
|
||||
|
||||
@ -52,14 +52,14 @@ ClientManager::~ClientManager()
|
||||
|
||||
void ClientManager::HandleNewConnectionTitanium(std::shared_ptr<EQ::Net::EQStream> 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<Client>(c));
|
||||
}
|
||||
|
||||
void ClientManager::HandleNewConnectionSod(std::shared_ptr<EQ::Net::EQStream> 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<Client>(c));
|
||||
}
|
||||
@ -67,7 +67,7 @@ void ClientManager::HandleNewConnectionSod(std::shared_ptr<EQ::Net::EQStream> co
|
||||
void ClientManager::HandleConnectionChange(std::shared_ptr<EQ::Net::EQStream> 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) {
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -2114,7 +2114,7 @@ Client *Clientlist::IsCharacterOnline(std::string CharacterName) {
|
||||
|
||||
void Clientlist::HandleNewConnection(std::shared_ptr<EQ::Net::EQStream> 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<Client>(c));
|
||||
}
|
||||
@ -2122,7 +2122,7 @@ void Clientlist::HandleNewConnection(std::shared_ptr<EQ::Net::EQStream> connecti
|
||||
void Clientlist::HandleConnectionChange(std::shared_ptr<EQ::Net::EQStream> 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<EQ::Net::EQStream> 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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user