1
0
mirror of https://github.com/gabime/spdlog.git synced 2025-03-31 18:32:40 +08:00

Fixed building under c++17

This commit is contained in:
gabime 2021-06-26 17:36:57 +03:00
parent 9ebc4b24d9
commit 68aed6a5eb
3 changed files with 148 additions and 228 deletions

View File

@ -235,24 +235,6 @@ if(SPDLOG_NO_EXCEPTIONS AND NOT MSVC)
target_compile_options(spdlog PRIVATE -fno-exceptions)
endif ()
# ---------------------------------------------------------------------------------------
# Allow override of level names
# ---------------------------------------------------------------------------------------
set(SPDLOG_LEVEL_NAME_TRACE "trace" CACHE STRING "custom level name")
set(SPDLOG_LEVEL_NAME_DEBUG "debug" CACHE STRING "custom level name")
set(SPDLOG_LEVEL_NAME_INFO "info" CACHE STRING "custom level name")
set(SPDLOG_LEVEL_NAME_WARNING "warning" CACHE STRING "custom level name")
set(SPDLOG_LEVEL_NAME_ERROR "error" CACHE STRING "custom level name")
set(SPDLOG_LEVEL_NAME_CRITICAL "critical" CACHE STRING "custom level name")
set(SPDLOG_LEVEL_NAME_OFF "off" CACHE STRING "custom level name")
target_compile_definitions(spdlog PUBLIC SPDLOG_LEVEL_NAME_TRACE=\"${SPDLOG_LEVEL_NAME_TRACE}\")
target_compile_definitions(spdlog PUBLIC SPDLOG_LEVEL_NAME_DEBUG=\"${SPDLOG_LEVEL_NAME_DEBUG}\")
target_compile_definitions(spdlog PUBLIC SPDLOG_LEVEL_NAME_INFO=\"${SPDLOG_LEVEL_NAME_INFO}\")
target_compile_definitions(spdlog PUBLIC SPDLOG_LEVEL_NAME_WARNING=\"${SPDLOG_LEVEL_NAME_WARNING}\")
target_compile_definitions(spdlog PUBLIC SPDLOG_LEVEL_NAME_ERROR=\"${SPDLOG_LEVEL_NAME_ERROR}\")
target_compile_definitions(spdlog PUBLIC SPDLOG_LEVEL_NAME_CRITICAL=\"${SPDLOG_LEVEL_NAME_CRITICAL}\")
target_compile_definitions(spdlog PUBLIC SPDLOG_LEVEL_NAME_OFF=\"${SPDLOG_LEVEL_NAME_OFF}\")
# ---------------------------------------------------------------------------------------
# Build binaries

View File

@ -152,38 +152,19 @@ enum level_enum
n_levels
};
#if !defined(SPDLOG_LEVEL_NAME_TRACE)
#define SPDLOG_LEVEL_NAME_TRACE "trace"
#endif
#if !defined(SPDLOG_LEVEL_NAME_DEBUG)
#define SPDLOG_LEVEL_NAME_DEBUG "debug"
#endif
#if !defined(SPDLOG_LEVEL_NAME_INFO)
#define SPDLOG_LEVEL_NAME_INFO "info"
#endif
#if !defined(SPDLOG_LEVEL_NAME_WARNING)
#define SPDLOG_LEVEL_NAME_WARNING "warning"
#endif
#if !defined(SPDLOG_LEVEL_NAME_ERROR)
#define SPDLOG_LEVEL_NAME_ERROR "error"
#endif
#if !defined(SPDLOG_LEVEL_NAME_CRITICAL)
#define SPDLOG_LEVEL_NAME_CRITICAL "critical"
#endif
#if !defined(SPDLOG_LEVEL_NAME_OFF)
#define SPDLOG_LEVEL_NAME_OFF "off"
#endif
#define SPDLOG_LEVEL_NAME_TRACE string_view_t("trace", 5)
#define SPDLOG_LEVEL_NAME_DEBUG string_view_t("debug", 5)
#define SPDLOG_LEVEL_NAME_INFO string_view_t("info", 4)
#define SPDLOG_LEVEL_NAME_WARNING string_view_t("warning", 7)
#define SPDLOG_LEVEL_NAME_ERROR string_view_t("error", 5)
#define SPDLOG_LEVEL_NAME_CRITICAL string_view_t("critical", 8)
#define SPDLOG_LEVEL_NAME_OFF string_view_t("off", 3)
#if !defined(SPDLOG_LEVEL_NAMES)
# define SPDLOG_LEVEL_NAMES \
{ \
SPDLOG_LEVEL_NAME_TRACE, SPDLOG_LEVEL_NAME_DEBUG, SPDLOG_LEVEL_NAME_INFO, SPDLOG_LEVEL_NAME_WARNING, SPDLOG_LEVEL_NAME_ERROR, SPDLOG_LEVEL_NAME_CRITICAL, SPDLOG_LEVEL_NAME_OFF \
SPDLOG_LEVEL_NAME_TRACE, SPDLOG_LEVEL_NAME_DEBUG, SPDLOG_LEVEL_NAME_INFO, SPDLOG_LEVEL_NAME_WARNING, SPDLOG_LEVEL_NAME_ERROR, \
SPDLOG_LEVEL_NAME_CRITICAL, SPDLOG_LEVEL_NAME_OFF \
}
#endif
@ -275,4 +256,3 @@ std::unique_ptr<T> make_unique(Args &&...args)
#ifdef SPDLOG_HEADER_ONLY
# include "common-inl.h"
#endif

View File

@ -93,48 +93,6 @@
// "MY ERROR", "MY CRITICAL", "OFF" }
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to customize the trace level name
//
// #define SPDLOG_LEVEL_NAME_TRACE "MY TRACE"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to customize the debug level name
//
// #define SPDLOG_LEVEL_NAME_DEBUG "MY DEBUG"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to customize the info level name
//
// #define SPDLOG_LEVEL_NAME_INFO "MY INFO"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to customize the warning level name
//
// #define SPDLOG_LEVEL_NAME_WARNING "MY WARNING"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to customize the error level name
//
// #define SPDLOG_LEVEL_NAME_ERROR "MY ERROR"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to customize the critical level name
//
// #define SPDLOG_LEVEL_NAME_CRITICAL "MY CRITICAL"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to customize the off level name
//
// #define SPDLOG_LEVEL_NAME_OFF "MY OFF"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to customize short level names (e.g. "MT")
// These can be longer than one character.