pragma icon indicating copy to clipboard operation
pragma copied to clipboard

Change logger to use std::format once clang supports it

Open Silverlan opened this issue 2 years ago • 0 comments

std::format is currently not properly supported by the clang compiler. Once it is supported, the logging system should be switched to it. Steps:

pragma/third_party_libs/spdlog/include/spdlog/tweakme.h: Change

#ifdef _WIN32
#define SPDLOG_USE_STD_FORMAT
#endif

to

#define SPDLOG_USE_STD_FORMAT

pragma/CMakeLists.txt: Change

if(WIN32)
	set(SPDLOG_USE_STD_FORMAT ON CACHE BOOL ON FORCE)
else()
	set(SPDLOG_USE_STD_FORMAT OFF CACHE BOOL OFF FORCE)
endif()

to

set(SPDLOG_USE_STD_FORMAT ON CACHE BOOL ON FORCE)

pragma/core/shared/include/pragma/entities/baseentity.h pragma/core/server/include/pragma/entities/s_baseentity.h pragma/core/client/include/pragma/entities/c_baseentity.h Remove #ifdef _WIN32 around the std::formatter code blocks and #include <format>.

pragma/core/shared/src/logging.cpp Remove #ifdef _WIN32 around the pragma::logging::client_type and pragma::logging::server_type definitions and remove the #else case.

For all instances where an entity is printed using Con::cout<<ent.print() (or cwar,...), change it to Con::cout<<ent.

Silverlan avatar Jan 22 '23 11:01 Silverlan