Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
68aed6a5
Commit
68aed6a5
authored
Jun 26, 2021
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed building under c++17
parent
9ebc4b24
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
148 additions
and
228 deletions
+148
-228
CMakeLists.txt
CMakeLists.txt
+86
-104
include/spdlog/common.h
include/spdlog/common.h
+62
-82
include/spdlog/tweakme.h
include/spdlog/tweakme.h
+0
-42
No files found.
CMakeLists.txt
View file @
68aed6a5
This diff is collapsed.
Click to expand it.
include/spdlog/common.h
View file @
68aed6a5
...
@@ -16,66 +16,66 @@
...
@@ -16,66 +16,66 @@
#include <functional>
#include <functional>
#ifdef SPDLOG_COMPILED_LIB
#ifdef SPDLOG_COMPILED_LIB
#undef SPDLOG_HEADER_ONLY
#
undef SPDLOG_HEADER_ONLY
#if defined(_WIN32) && defined(SPDLOG_SHARED_LIB)
#
if defined(_WIN32) && defined(SPDLOG_SHARED_LIB)
#ifdef spdlog_EXPORTS
#
ifdef spdlog_EXPORTS
#define SPDLOG_API __declspec(dllexport)
#
define SPDLOG_API __declspec(dllexport)
#else
#
else
#define SPDLOG_API __declspec(dllimport)
#
define SPDLOG_API __declspec(dllimport)
#endif
#
endif
#else // !defined(_WIN32) || !defined(SPDLOG_SHARED_LIB)
#
else // !defined(_WIN32) || !defined(SPDLOG_SHARED_LIB)
#define SPDLOG_API
#
define SPDLOG_API
#endif
#
endif
#define SPDLOG_INLINE
#
define SPDLOG_INLINE
#else // !defined(SPDLOG_COMPILED_LIB)
#else // !defined(SPDLOG_COMPILED_LIB)
#define SPDLOG_API
#
define SPDLOG_API
#define SPDLOG_HEADER_ONLY
#
define SPDLOG_HEADER_ONLY
#define SPDLOG_INLINE inline
#
define SPDLOG_INLINE inline
#endif // #ifdef SPDLOG_COMPILED_LIB
#endif // #ifdef SPDLOG_COMPILED_LIB
#include <spdlog/fmt/fmt.h>
#include <spdlog/fmt/fmt.h>
// visual studio upto 2013 does not support noexcept nor constexpr
// visual studio upto 2013 does not support noexcept nor constexpr
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define SPDLOG_NOEXCEPT _NOEXCEPT
#
define SPDLOG_NOEXCEPT _NOEXCEPT
#define SPDLOG_CONSTEXPR
#
define SPDLOG_CONSTEXPR
#else
#else
#define SPDLOG_NOEXCEPT noexcept
#
define SPDLOG_NOEXCEPT noexcept
#define SPDLOG_CONSTEXPR constexpr
#
define SPDLOG_CONSTEXPR constexpr
#endif
#endif
#if defined(__GNUC__) || defined(__clang__)
#if defined(__GNUC__) || defined(__clang__)
#define SPDLOG_DEPRECATED __attribute__((deprecated))
#
define SPDLOG_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
#elif defined(_MSC_VER)
#define SPDLOG_DEPRECATED __declspec(deprecated)
#
define SPDLOG_DEPRECATED __declspec(deprecated)
#else
#else
#define SPDLOG_DEPRECATED
#
define SPDLOG_DEPRECATED
#endif
#endif
// disable thread local on msvc 2013
// disable thread local on msvc 2013
#ifndef SPDLOG_NO_TLS
#ifndef SPDLOG_NO_TLS
#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt)
#
if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt)
#define SPDLOG_NO_TLS 1
#
define SPDLOG_NO_TLS 1
#endif
#
endif
#endif
#endif
#ifndef SPDLOG_FUNCTION
#ifndef SPDLOG_FUNCTION
#define SPDLOG_FUNCTION static_cast<const char *>(__FUNCTION__)
#
define SPDLOG_FUNCTION static_cast<const char *>(__FUNCTION__)
#endif
#endif
#ifdef SPDLOG_NO_EXCEPTIONS
#ifdef SPDLOG_NO_EXCEPTIONS
#define SPDLOG_TRY
#
define SPDLOG_TRY
#
define SPDLOG_THROW(ex)
\
#
define SPDLOG_THROW(ex)
\
do \
do \
{ \
{ \
printf("spdlog fatal error: %s\n", ex.what()); \
printf("spdlog fatal error: %s\n", ex.what()); \
std::abort(); \
std::abort(); \
} while (0)
} while (0)
#define SPDLOG_CATCH_STD
#
define SPDLOG_CATCH_STD
#else
#else
#define SPDLOG_TRY try
#
define SPDLOG_TRY try
#define SPDLOG_THROW(ex) throw(ex)
#
define SPDLOG_THROW(ex) throw(ex)
#
define SPDLOG_CATCH_STD
\
#
define SPDLOG_CATCH_STD
\
catch (const std::exception &) {}
catch (const std::exception &) {}
#endif
#endif
...
@@ -90,11 +90,11 @@ class sink;
...
@@ -90,11 +90,11 @@ class sink;
#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
using
filename_t
=
std
::
wstring
;
using
filename_t
=
std
::
wstring
;
// allow macro expansion to occur in SPDLOG_FILENAME_T
// allow macro expansion to occur in SPDLOG_FILENAME_T
#define SPDLOG_FILENAME_T_INNER(s) L##s
#
define SPDLOG_FILENAME_T_INNER(s) L##s
#define SPDLOG_FILENAME_T(s) SPDLOG_FILENAME_T_INNER(s)
#
define SPDLOG_FILENAME_T(s) SPDLOG_FILENAME_T_INNER(s)
#else
#else
using
filename_t
=
std
::
string
;
using
filename_t
=
std
::
string
;
#define SPDLOG_FILENAME_T(s) s
#
define SPDLOG_FILENAME_T(s) s
#endif
#endif
using
log_clock
=
std
::
chrono
::
system_clock
;
using
log_clock
=
std
::
chrono
::
system_clock
;
...
@@ -107,13 +107,13 @@ using memory_buf_t = fmt::basic_memory_buffer<char, 250>;
...
@@ -107,13 +107,13 @@ using memory_buf_t = fmt::basic_memory_buffer<char, 250>;
using
wmemory_buf_t
=
fmt
::
basic_memory_buffer
<
wchar_t
,
250
>
;
using
wmemory_buf_t
=
fmt
::
basic_memory_buffer
<
wchar_t
,
250
>
;
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
#ifndef _WIN32
#
ifndef _WIN32
#error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows
#
error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows
#else
#
else
template
<
typename
T
>
template
<
typename
T
>
struct
is_convertible_to_wstring_view
:
std
::
is_convertible
<
T
,
wstring_view_t
>
struct
is_convertible_to_wstring_view
:
std
::
is_convertible
<
T
,
wstring_view_t
>
{};
{};
#endif // _WIN32
#
endif // _WIN32
#else
#else
template
<
typename
>
template
<
typename
>
struct
is_convertible_to_wstring_view
:
std
::
false_type
struct
is_convertible_to_wstring_view
:
std
::
false_type
...
@@ -135,7 +135,7 @@ using level_t = std::atomic<int>;
...
@@ -135,7 +135,7 @@ using level_t = std::atomic<int>;
#define SPDLOG_LEVEL_OFF 6
#define SPDLOG_LEVEL_OFF 6
#if !defined(SPDLOG_ACTIVE_LEVEL)
#if !defined(SPDLOG_ACTIVE_LEVEL)
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO
#
define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO
#endif
#endif
// Log level enum
// Log level enum
...
@@ -152,44 +152,25 @@ enum level_enum
...
@@ -152,44 +152,25 @@ enum level_enum
n_levels
n_levels
};
};
#if !defined(SPDLOG_LEVEL_NAME_TRACE)
#define SPDLOG_LEVEL_NAME_TRACE string_view_t("trace", 5)
#define SPDLOG_LEVEL_NAME_TRACE "trace"
#define SPDLOG_LEVEL_NAME_DEBUG string_view_t("debug", 5)
#endif
#define SPDLOG_LEVEL_NAME_INFO string_view_t("info", 4)
#define SPDLOG_LEVEL_NAME_WARNING string_view_t("warning", 7)
#if !defined(SPDLOG_LEVEL_NAME_DEBUG)
#define SPDLOG_LEVEL_NAME_ERROR string_view_t("error", 5)
#define SPDLOG_LEVEL_NAME_DEBUG "debug"
#define SPDLOG_LEVEL_NAME_CRITICAL string_view_t("critical", 8)
#endif
#define SPDLOG_LEVEL_NAME_OFF string_view_t("off", 3)
#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
#if !defined(SPDLOG_LEVEL_NAMES)
#if !defined(SPDLOG_LEVEL_NAMES)
#
define 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
#endif
#if !defined(SPDLOG_SHORT_LEVEL_NAMES)
#if !defined(SPDLOG_SHORT_LEVEL_NAMES)
#
define SPDLOG_SHORT_LEVEL_NAMES
\
#
define SPDLOG_SHORT_LEVEL_NAMES
\
{ \
{ \
"T", "D", "I", "W", "E", "C", "O" \
"T", "D", "I", "W", "E", "C", "O" \
}
}
...
@@ -273,6 +254,5 @@ std::unique_ptr<T> make_unique(Args &&...args)
...
@@ -273,6 +254,5 @@ std::unique_ptr<T> make_unique(Args &&...args)
}
// namespace spdlog
}
// namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
#ifdef SPDLOG_HEADER_ONLY
#include "common-inl.h"
#
include "common-inl.h"
#endif
#endif
include/spdlog/tweakme.h
View file @
68aed6a5
...
@@ -93,48 +93,6 @@
...
@@ -93,48 +93,6 @@
// "MY ERROR", "MY CRITICAL", "OFF" }
// "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")
// Uncomment to customize short level names (e.g. "MT")
// These can be longer than one character.
// These can be longer than one character.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment