diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ad551966..f7d132930 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -340,17 +340,18 @@ ENDIF(EQEMU_BUILD_LUA) INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}") INCLUDE_DIRECTORIES(SYSTEM "${MySQL_INCLUDE_DIR}") -INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/common/glm") -INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/cereal") +INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/glm") +INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/cereal/include") +INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/fmt/include") INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/libuv/include" ) INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/libuv/src") -INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/format") INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/recast/detour/include") INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/recast/recast/include") IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC) ADD_SUBDIRECTORY(common) ADD_SUBDIRECTORY(libs) + ADD_SUBDIRECTORY(submodules/fmt) ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC) IF(EQEMU_BUILD_SERVER) ADD_SUBDIRECTORY(shared_memory) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 3b4fbd870..b26eb850c 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -136,6 +136,7 @@ SET(common_headers eqemu_config.h eqemu_config_elements.h eqemu_logsys.h + eqemu_logsys_fmt.h eq_limits.h eq_packet.h eq_stream_ident.h diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index fb42ac8b4..c864e807c 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -21,7 +21,6 @@ #ifndef EQEMU_LOGSYS_H #define EQEMU_LOGSYS_H -#include #include #include #include @@ -164,7 +163,7 @@ namespace Logs { #define LogF(debug_level, log_category, message, ...) do {\ if (LogSys.log_settings[log_category].is_category_enabled == 1)\ - LogSys.OutF(debug_level, log_category, message, ##__VA_ARGS__);\ + OutF(LogSys, debug_level, log_category, message, ##__VA_ARGS__);\ } while (0) class EQEmuLogSys { @@ -197,13 +196,6 @@ public: void SetCurrentTimeStamp(char* time_stamp); void StartFileLogs(const std::string &log_name = ""); - 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/eqemu_logsys_fmt.h b/common/eqemu_logsys_fmt.h new file mode 100644 index 000000000..3a6a9f67d --- /dev/null +++ b/common/eqemu_logsys_fmt.h @@ -0,0 +1,30 @@ +/** + * EQEmulator: Everquest Server Emulator + * Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY except by those people which sell it, which + * are required to give you total support for your newly bought product; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * +*/ + +#pragma once + +#include + +template +void OutF(EQEmuLogSys &ls, Logs::DebugLevel debug_level, uint16 log_category, const char *fmt, const Args&... args) +{ + std::string log_str = fmt::format(fmt, args...); + ls.Out(debug_level, log_category, log_str); +} diff --git a/common/net/console_server_connection.cpp b/common/net/console_server_connection.cpp index 7cff94cbb..795c73140 100644 --- a/common/net/console_server_connection.cpp +++ b/common/net/console_server_connection.cpp @@ -4,6 +4,7 @@ #include "../eqemu_logsys.h" #include "../servertalk.h" #include "../rulesys.h" +#include EQ::Net::ConsoleServerConnection::ConsoleServerConnection(ConsoleServer *parent, std::shared_ptr connection) { diff --git a/common/net/daybreak_connection.cpp b/common/net/daybreak_connection.cpp index daa54958c..ecd8c90a7 100644 --- a/common/net/daybreak_connection.cpp +++ b/common/net/daybreak_connection.cpp @@ -2,6 +2,7 @@ #include "../event/event_loop.h" #include "../event/task.h" #include "../eqemu_logsys.h" +#include "../eqemu_logsys_fmt.h" #include "../data_verification.h" #include "crc32.h" #include diff --git a/common/net/eqstream.cpp b/common/net/eqstream.cpp index 8f97addd5..8e05071e7 100644 --- a/common/net/eqstream.cpp +++ b/common/net/eqstream.cpp @@ -1,5 +1,6 @@ #include "eqstream.h" #include "../eqemu_logsys.h" +#include "../eqemu_logsys_fmt.h" EQ::Net::EQStreamManager::EQStreamManager(EQStreamManagerOptions &options) : m_daybreak(options.daybreak_options) { diff --git a/common/net/packet.cpp b/common/net/packet.cpp index deaa07843..1ae959e62 100644 --- a/common/net/packet.cpp +++ b/common/net/packet.cpp @@ -1,7 +1,7 @@ #include "packet.h" #include "endian.h" -#include #include +#include void EQ::Net::Packet::PutInt8(size_t offset, int8_t value) { diff --git a/common/net/servertalk_client_connection.cpp b/common/net/servertalk_client_connection.cpp index 676d9d024..0b77fc073 100644 --- a/common/net/servertalk_client_connection.cpp +++ b/common/net/servertalk_client_connection.cpp @@ -1,6 +1,7 @@ #include "servertalk_client_connection.h" #include "dns.h" #include "../eqemu_logsys.h" +#include "../eqemu_logsys_fmt.h" EQ::Net::ServertalkClient::ServertalkClient(const std::string &addr, int port, bool ipv6, const std::string &identifier, const std::string &credentials) : m_timer(std::unique_ptr(new EQ::Timer(100, true, std::bind(&EQ::Net::ServertalkClient::Connect, this)))) diff --git a/common/net/servertalk_legacy_client_connection.cpp b/common/net/servertalk_legacy_client_connection.cpp index 1e31f406f..851ca3541 100644 --- a/common/net/servertalk_legacy_client_connection.cpp +++ b/common/net/servertalk_legacy_client_connection.cpp @@ -1,6 +1,7 @@ #include "servertalk_legacy_client_connection.h" #include "dns.h" #include "../eqemu_logsys.h" +#include "../eqemu_logsys_fmt.h" EQ::Net::ServertalkLegacyClient::ServertalkLegacyClient(const std::string &addr, int port, bool ipv6) : m_timer(std::unique_ptr(new EQ::Timer(100, true, std::bind(&EQ::Net::ServertalkLegacyClient::Connect, this)))) diff --git a/common/net/servertalk_server_connection.cpp b/common/net/servertalk_server_connection.cpp index c211545f0..fa52d8f9e 100644 --- a/common/net/servertalk_server_connection.cpp +++ b/common/net/servertalk_server_connection.cpp @@ -1,6 +1,7 @@ #include "servertalk_server_connection.h" #include "servertalk_server.h" #include "../eqemu_logsys.h" +#include "../eqemu_logsys_fmt.h" #include "../util/uuid.h" EQ::Net::ServertalkServerConnection::ServertalkServerConnection(std::shared_ptr c, EQ::Net::ServertalkServer *parent, bool encrypted, bool allow_downgrade) diff --git a/common/servertalk.h b/common/servertalk.h index a6b866fbe..b942eb547 100644 --- a/common/servertalk.h +++ b/common/servertalk.h @@ -4,7 +4,7 @@ #include "../common/types.h" #include "../common/packet_functions.h" #include "../common/eq_packet_structs.h" -#include "../net/packet.h" +#include "../common/net/packet.h" #include #include diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index 801f5fdd9..47bf5c83a 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -3,5 +3,4 @@ IF(EQEMU_BUILD_LUA) ENDIF(EQEMU_BUILD_LUA) ADD_SUBDIRECTORY(libuv) -ADD_SUBDIRECTORY(format) ADD_SUBDIRECTORY(recast) \ No newline at end of file diff --git a/loginserver/client.cpp b/loginserver/client.cpp index 602967e38..6ca13a4c1 100644 --- a/loginserver/client.cpp +++ b/loginserver/client.cpp @@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "login_structures.h" #include "../common/misc_functions.h" #include "../common/eqemu_logsys.h" +#include "../common/eqemu_logsys_fmt.h" extern LoginServer server; diff --git a/loginserver/client_manager.cpp b/loginserver/client_manager.cpp index 4e1461036..570a4be1f 100644 --- a/loginserver/client_manager.cpp +++ b/loginserver/client_manager.cpp @@ -22,6 +22,7 @@ extern LoginServer server; extern bool run_server; #include "../common/eqemu_logsys.h" +#include "../common/eqemu_logsys_fmt.h" ClientManager::ClientManager() { diff --git a/loginserver/database_mysql.cpp b/loginserver/database_mysql.cpp index 83c980086..af5010925 100644 --- a/loginserver/database_mysql.cpp +++ b/loginserver/database_mysql.cpp @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "database_mysql.h" #include "login_server.h" #include "../common/eqemu_logsys.h" +#include "../common/eqemu_logsys_fmt.h" #include "../common/string_util.h" extern LoginServer server; diff --git a/loginserver/server_manager.cpp b/loginserver/server_manager.cpp index 550dba806..fd2e8ec95 100644 --- a/loginserver/server_manager.cpp +++ b/loginserver/server_manager.cpp @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include "../common/eqemu_logsys.h" +#include "../common/eqemu_logsys_fmt.h" extern LoginServer server; extern bool run_server; @@ -265,4 +266,4 @@ void ServerManager::DestroyServerByName(std::string l_name, std::string s_name, ++iter; } -} \ No newline at end of file +} diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index d00e79606..b7adb84eb 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "../common/global_define.h" #include "../common/string_util.h" #include "../common/eqemu_logsys.h" +#include "../common/eqemu_logsys_fmt.h" #include "../common/misc_functions.h" #include "clientlist.h" diff --git a/ucs/worldserver.h b/ucs/worldserver.h index aad68e085..9617a1f95 100644 --- a/ucs/worldserver.h +++ b/ucs/worldserver.h @@ -18,7 +18,7 @@ #ifndef WORLDSERVER_H #define WORLDSERVER_H -#include "../net/servertalk_client_connection.h" +#include "../common/net/servertalk_client_connection.h" #include "../common/eq_packet_structs.h" #include diff --git a/world/console.cpp b/world/console.cpp index 8326737c2..e5f790019 100644 --- a/world/console.cpp +++ b/world/console.cpp @@ -9,6 +9,7 @@ #include "zoneserver.h" #include "../common/string_util.h" #include "../common/md5.h" +#include extern ClientList client_list; extern ZSList zoneserver_list; diff --git a/world/launcher_link.h b/world/launcher_link.h index 00d109d0d..8b273d5d2 100644 --- a/world/launcher_link.h +++ b/world/launcher_link.h @@ -19,8 +19,8 @@ #define LAUNCHERLINK_H_ #include "../common/timer.h" -#include "../net/servertalk_server_connection.h" -#include "../event/timer.h" +#include "../common/net/servertalk_server_connection.h" +#include "../common/event/timer.h" #include #include #include diff --git a/world/launcher_list.h b/world/launcher_list.h index 6926a76bd..06156cd7e 100644 --- a/world/launcher_list.h +++ b/world/launcher_list.h @@ -19,7 +19,7 @@ #define LAUNCHERLIST_H_ #include "../common/types.h" -#include "../net/servertalk_server_connection.h" +#include "../common/net/servertalk_server_connection.h" #include #include #include diff --git a/world/login_server.cpp b/world/login_server.cpp index 00a321953..b642e77ad 100644 --- a/world/login_server.cpp +++ b/world/login_server.cpp @@ -24,11 +24,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "../common/version.h" #include "../common/servertalk.h" #include "../common/misc_functions.h" -#include "login_server.h" -#include "login_server_list.h" #include "../common/eq_packet_structs.h" #include "../common/packet_dump.h" #include "../common/string_util.h" +#include "../common/eqemu_logsys.h" +#include "../common/eqemu_logsys_fmt.h" +#include "login_server.h" +#include "login_server_list.h" #include "zoneserver.h" #include "worlddb.h" #include "zonelist.h" diff --git a/world/net.cpp b/world/net.cpp index 347d9ff77..e8c203179 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "../common/string_util.h" #include "../common/eqemu_logsys.h" +#include "../common/eqemu_logsys_fmt.h" #include "../common/queue.h" #include "../common/timer.h" #include "../common/eq_packet.h" diff --git a/world/zoneserver.h b/world/zoneserver.h index f5d7296df..af4641935 100644 --- a/world/zoneserver.h +++ b/world/zoneserver.h @@ -19,9 +19,9 @@ #define ZONESERVER_H #include "world_tcp_connection.h" -#include "../net/servertalk_server.h" -#include "../event/timer.h" -#include "../timer.h" +#include "../common/net/servertalk_server.h" +#include "../common/event/timer.h" +#include "../common/timer.h" #include "console.h" #include #include diff --git a/zone/net.cpp b/zone/net.cpp index 814c6c3d0..6611205f6 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -42,6 +42,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "../common/eqemu_exception.h" #include "../common/spdat.h" #include "../common/eqemu_logsys.h" +#include "../common/eqemu_logsys_fmt.h" #include "zone_config.h" #include "masterentity.h" diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index cf79aae08..c1377ab14 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "../common/rulesys.h" #include "../common/string_util.h" #include "../common/misc_functions.h" +#include "../common/eqemu_logsys.h" +#include "../common/eqemu_logsys_fmt.h" #include "map.h" #include "npc.h"