mirror of
https://github.com/gabime/spdlog.git
synced 2026-01-02 09:57:55 +08:00
Set IndentPPDirectives to "None" on clang-format
This commit is contained in:
@@ -13,7 +13,6 @@ AlignEscapedNewlines: Left
|
|||||||
AlwaysBreakTemplateDeclarations: Yes
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
PackConstructorInitializers: Never
|
PackConstructorInitializers: Never
|
||||||
BreakConstructorInitializersBeforeComma: false
|
BreakConstructorInitializersBeforeComma: false
|
||||||
IndentPPDirectives: BeforeHash
|
IndentPPDirectives: None
|
||||||
SortIncludes: Never
|
SortIncludes: Never
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,11 @@
|
|||||||
#include "spdlog/sinks/basic_file_sink.h"
|
#include "spdlog/sinks/basic_file_sink.h"
|
||||||
|
|
||||||
#if defined(SPDLOG_USE_STD_FORMAT)
|
#if defined(SPDLOG_USE_STD_FORMAT)
|
||||||
#include <format>
|
#include <format>
|
||||||
#elif defined(SPDLOG_FMT_EXTERNAL)
|
#elif defined(SPDLOG_FMT_EXTERNAL)
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#else
|
#else
|
||||||
#include "spdlog/fmt/bundled/format.h"
|
#include "spdlog/fmt/bundled/format.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
@@ -34,8 +34,8 @@ using namespace utils;
|
|||||||
void bench_mt(int howmany, std::shared_ptr<spdlog::logger> log, int thread_count);
|
void bench_mt(int howmany, std::shared_ptr<spdlog::logger> log, int thread_count);
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4996) // disable fopen warning under msvc
|
#pragma warning(disable : 4996) // disable fopen warning under msvc
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
int count_lines(const char *filename) {
|
int count_lines(const char *filename) {
|
||||||
@@ -62,7 +62,7 @@ void verify_file(const char *filename, int expected_count) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|||||||
@@ -13,11 +13,11 @@
|
|||||||
#include "spdlog/sinks/rotating_file_sink.h"
|
#include "spdlog/sinks/rotating_file_sink.h"
|
||||||
|
|
||||||
#if defined(SPDLOG_USE_STD_FORMAT)
|
#if defined(SPDLOG_USE_STD_FORMAT)
|
||||||
#include <format>
|
#include <format>
|
||||||
#elif defined(SPDLOG_FMT_EXTERNAL)
|
#elif defined(SPDLOG_FMT_EXTERNAL)
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#else
|
#else
|
||||||
#include "spdlog/fmt/bundled/format.h"
|
#include "spdlog/fmt/bundled/format.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ void async_example() {
|
|||||||
// {:n} - don't split the output to lines.
|
// {:n} - don't split the output to lines.
|
||||||
|
|
||||||
#if !defined SPDLOG_USE_STD_FORMAT || defined(_MSC_VER)
|
#if !defined SPDLOG_USE_STD_FORMAT || defined(_MSC_VER)
|
||||||
#include "spdlog/fmt/bin_to_hex.h"
|
#include "spdlog/fmt/bin_to_hex.h"
|
||||||
void binary_example() {
|
void binary_example() {
|
||||||
std::vector<char> buf;
|
std::vector<char> buf;
|
||||||
for (int i = 0; i < 80; i++) {
|
for (int i = 0; i < 80; i++) {
|
||||||
@@ -207,7 +207,7 @@ void binary_example() {
|
|||||||
|
|
||||||
// Log a vector of numbers
|
// Log a vector of numbers
|
||||||
#ifndef SPDLOG_USE_STD_FORMAT
|
#ifndef SPDLOG_USE_STD_FORMAT
|
||||||
#include "spdlog/fmt/ranges.h"
|
#include "spdlog/fmt/ranges.h"
|
||||||
void vector_example() {
|
void vector_example() {
|
||||||
std::vector<int> vec = {1, 2, 3};
|
std::vector<int> vec = {1, 2, 3};
|
||||||
spdlog::info("Vector example: {}", vec);
|
spdlog::info("Vector example: {}", vec);
|
||||||
@@ -301,7 +301,7 @@ void err_handler_example() {
|
|||||||
|
|
||||||
// syslog example (linux/osx/freebsd)
|
// syslog example (linux/osx/freebsd)
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include "spdlog/sinks/syslog_sink.h"
|
#include "spdlog/sinks/syslog_sink.h"
|
||||||
void syslog_example() {
|
void syslog_example() {
|
||||||
std::string ident = "spdlog-example";
|
std::string ident = "spdlog-example";
|
||||||
auto syslog_logger = spdlog::syslog_logger_mt("syslog", ident, LOG_PID);
|
auto syslog_logger = spdlog::syslog_logger_mt("syslog", ident, LOG_PID);
|
||||||
@@ -311,7 +311,7 @@ void syslog_example() {
|
|||||||
|
|
||||||
// Android example.
|
// Android example.
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
#include "spdlog/sinks/android_sink.h"
|
#include "spdlog/sinks/android_sink.h"
|
||||||
void android_example() {
|
void android_example() {
|
||||||
std::string tag = "spdlog-android";
|
std::string tag = "spdlog-android";
|
||||||
auto android_logger = spdlog::android_logger_mt("android", tag);
|
auto android_logger = spdlog::android_logger_mt("android", tag);
|
||||||
@@ -386,7 +386,7 @@ void replace_default_logger_example() {
|
|||||||
// thread-local storage.
|
// thread-local storage.
|
||||||
|
|
||||||
#ifndef SPDLOG_NO_TLS
|
#ifndef SPDLOG_NO_TLS
|
||||||
#include "spdlog/mdc.h"
|
#include "spdlog/mdc.h"
|
||||||
void mdc_example() {
|
void mdc_example() {
|
||||||
spdlog::mdc::put("key1", "value1");
|
spdlog::mdc::put("key1", "value1");
|
||||||
spdlog::mdc::put("key2", "value2");
|
spdlog::mdc::put("key2", "value2");
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/async_logger.h>
|
#include <spdlog/async_logger.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/details/thread_pool.h>
|
#include <spdlog/details/thread_pool.h>
|
||||||
|
|||||||
@@ -70,5 +70,5 @@ private:
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "async_logger-inl.h"
|
#include "async_logger-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/cfg/helpers.h>
|
#include <spdlog/cfg/helpers.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/details/os.h>
|
#include <spdlog/details/os.h>
|
||||||
|
|||||||
@@ -25,5 +25,5 @@ SPDLOG_API void load_levels(const std::string &txt);
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "helpers-inl.h"
|
#include "helpers-inl.h"
|
||||||
#endif // SPDLOG_HEADER_ONLY
|
#endif // SPDLOG_HEADER_ONLY
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/common.h>
|
#include <spdlog/common.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|||||||
@@ -17,57 +17,57 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#ifdef SPDLOG_USE_STD_FORMAT
|
#ifdef SPDLOG_USE_STD_FORMAT
|
||||||
#include <version>
|
#include <version>
|
||||||
#if __cpp_lib_format >= 202207L
|
#if __cpp_lib_format >= 202207L
|
||||||
#include <format>
|
#include <format>
|
||||||
#else
|
#else
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SPDLOG_COMPILED_LIB
|
#ifdef SPDLOG_COMPILED_LIB
|
||||||
#undef SPDLOG_HEADER_ONLY
|
#undef SPDLOG_HEADER_ONLY
|
||||||
#if defined(SPDLOG_SHARED_LIB)
|
#if defined(SPDLOG_SHARED_LIB)
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#ifdef spdlog_EXPORTS
|
#ifdef spdlog_EXPORTS
|
||||||
#define SPDLOG_API __declspec(dllexport)
|
#define SPDLOG_API __declspec(dllexport)
|
||||||
#else // !spdlog_EXPORTS
|
#else // !spdlog_EXPORTS
|
||||||
#define SPDLOG_API __declspec(dllimport)
|
#define SPDLOG_API __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
#else // !defined(_WIN32)
|
#else // !defined(_WIN32)
|
||||||
#define SPDLOG_API __attribute__((visibility("default")))
|
#define SPDLOG_API __attribute__((visibility("default")))
|
||||||
#endif
|
#endif
|
||||||
#else // !defined(SPDLOG_SHARED_LIB)
|
#else // !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>
|
||||||
|
|
||||||
#if !defined(SPDLOG_USE_STD_FORMAT) && \
|
#if !defined(SPDLOG_USE_STD_FORMAT) && \
|
||||||
FMT_VERSION >= 80000 // backward compatibility with fmt versions older than 8
|
FMT_VERSION >= 80000 // backward compatibility with fmt versions older than 8
|
||||||
#define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string)
|
#define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string)
|
||||||
#define SPDLOG_FMT_STRING(format_string) FMT_STRING(format_string)
|
#define SPDLOG_FMT_STRING(format_string) FMT_STRING(format_string)
|
||||||
#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
||||||
#include <spdlog/fmt/xchar.h>
|
#include <spdlog/fmt/xchar.h>
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_FMT_RUNTIME(format_string) format_string
|
#define SPDLOG_FMT_RUNTIME(format_string) format_string
|
||||||
#define SPDLOG_FMT_STRING(format_string) format_string
|
#define SPDLOG_FMT_STRING(format_string) format_string
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// visual studio up to 2013 does not support noexcept nor constexpr
|
// visual studio up to 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 building with std::format, can just use constexpr, otherwise if building with fmt
|
// If building with std::format, can just use constexpr, otherwise if building with fmt
|
||||||
@@ -76,46 +76,46 @@
|
|||||||
// depending on the compiler
|
// depending on the compiler
|
||||||
// If fmt determines it can't use constexpr, we should inline the function instead
|
// If fmt determines it can't use constexpr, we should inline the function instead
|
||||||
#ifdef SPDLOG_USE_STD_FORMAT
|
#ifdef SPDLOG_USE_STD_FORMAT
|
||||||
#define SPDLOG_CONSTEXPR_FUNC constexpr
|
#define SPDLOG_CONSTEXPR_FUNC constexpr
|
||||||
#else // Being built with fmt
|
#else // Being built with fmt
|
||||||
#if FMT_USE_CONSTEXPR
|
#if FMT_USE_CONSTEXPR
|
||||||
#define SPDLOG_CONSTEXPR_FUNC FMT_CONSTEXPR
|
#define SPDLOG_CONSTEXPR_FUNC FMT_CONSTEXPR
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_CONSTEXPR_FUNC inline
|
#define SPDLOG_CONSTEXPR_FUNC inline
|
||||||
#endif
|
#endif
|
||||||
#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
|
||||||
@@ -130,12 +130,12 @@ 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;
|
||||||
@@ -149,28 +149,28 @@ using string_view_t = std::string_view;
|
|||||||
using memory_buf_t = std::string;
|
using memory_buf_t = std::string;
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
#if __cpp_lib_format >= 202207L
|
#if __cpp_lib_format >= 202207L
|
||||||
using format_string_t = std::format_string<Args...>;
|
using format_string_t = std::format_string<Args...>;
|
||||||
#else
|
#else
|
||||||
using format_string_t = std::string_view;
|
using format_string_t = std::string_view;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <class T, class Char = char>
|
template <class T, class Char = char>
|
||||||
struct is_convertible_to_basic_format_string
|
struct is_convertible_to_basic_format_string
|
||||||
: std::integral_constant<bool, std::is_convertible<T, std::basic_string_view<Char>>::value> {};
|
: std::integral_constant<bool, std::is_convertible<T, std::basic_string_view<Char>>::value> {};
|
||||||
|
|
||||||
#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
||||||
using wstring_view_t = std::wstring_view;
|
using wstring_view_t = std::wstring_view;
|
||||||
using wmemory_buf_t = std::wstring;
|
using wmemory_buf_t = std::wstring;
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
#if __cpp_lib_format >= 202207L
|
#if __cpp_lib_format >= 202207L
|
||||||
using wformat_string_t = std::wformat_string<Args...>;
|
using wformat_string_t = std::wformat_string<Args...>;
|
||||||
#else
|
#else
|
||||||
using wformat_string_t = std::wstring_view;
|
using wformat_string_t = std::wstring_view;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#define SPDLOG_BUF_TO_STRING(x) x
|
#define SPDLOG_BUF_TO_STRING(x) x
|
||||||
#else // use fmt lib instead of std::format
|
#else // use fmt lib instead of std::format
|
||||||
namespace fmt_lib = fmt;
|
namespace fmt_lib = fmt;
|
||||||
|
|
||||||
@@ -184,11 +184,11 @@ template <class T>
|
|||||||
using remove_cvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type;
|
using remove_cvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type;
|
||||||
|
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
#if FMT_VERSION >= 90101
|
#if FMT_VERSION >= 90101
|
||||||
using fmt_runtime_string = fmt::runtime_format_string<Char>;
|
using fmt_runtime_string = fmt::runtime_format_string<Char>;
|
||||||
#else
|
#else
|
||||||
using fmt_runtime_string = fmt::basic_runtime<Char>;
|
using fmt_runtime_string = fmt::basic_runtime<Char>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// clang doesn't like SFINAE disabled constructor in std::is_convertible<> so have to repeat the
|
// clang doesn't like SFINAE disabled constructor in std::is_convertible<> so have to repeat the
|
||||||
// condition from basic_format_string here, in addition, fmt::basic_runtime<Char> is only
|
// condition from basic_format_string here, in addition, fmt::basic_runtime<Char> is only
|
||||||
@@ -200,20 +200,20 @@ struct is_convertible_to_basic_format_string
|
|||||||
std::is_same<remove_cvref_t<T>, fmt_runtime_string<Char>>::value> {
|
std::is_same<remove_cvref_t<T>, fmt_runtime_string<Char>>::value> {
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
||||||
using wstring_view_t = fmt::basic_string_view<wchar_t>;
|
using wstring_view_t = fmt::basic_string_view<wchar_t>;
|
||||||
using wmemory_buf_t = fmt::basic_memory_buffer<wchar_t, 250>;
|
using wmemory_buf_t = fmt::basic_memory_buffer<wchar_t, 250>;
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
using wformat_string_t = fmt::wformat_string<Args...>;
|
using wformat_string_t = fmt::wformat_string<Args...>;
|
||||||
#endif
|
#endif
|
||||||
#define SPDLOG_BUF_TO_STRING(x) fmt::to_string(x)
|
#define SPDLOG_BUF_TO_STRING(x) fmt::to_string(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#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
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
|
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -237,7 +237,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
|
||||||
@@ -262,7 +262,7 @@ enum level_enum : int {
|
|||||||
#define SPDLOG_LEVEL_NAME_OFF spdlog::string_view_t("off", 3)
|
#define SPDLOG_LEVEL_NAME_OFF spdlog::string_view_t("off", 3)
|
||||||
|
|
||||||
#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_TRACE, SPDLOG_LEVEL_NAME_DEBUG, SPDLOG_LEVEL_NAME_INFO, \
|
||||||
SPDLOG_LEVEL_NAME_WARNING, SPDLOG_LEVEL_NAME_ERROR, SPDLOG_LEVEL_NAME_CRITICAL, \
|
SPDLOG_LEVEL_NAME_WARNING, SPDLOG_LEVEL_NAME_ERROR, SPDLOG_LEVEL_NAME_CRITICAL, \
|
||||||
@@ -272,7 +272,7 @@ enum level_enum : int {
|
|||||||
|
|
||||||
#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" }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -402,5 +402,5 @@ constexpr T conditional_static_cast(U value) {
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "common-inl.h"
|
#include "common-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/details/backtracer.h>
|
#include <spdlog/details/backtracer.h>
|
||||||
#endif
|
#endif
|
||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
namespace details {
|
namespace details {
|
||||||
|
|||||||
@@ -41,5 +41,5 @@ public:
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "backtracer-inl.h"
|
#include "backtracer-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/details/file_helper.h>
|
#include <spdlog/details/file_helper.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/common.h>
|
#include <spdlog/common.h>
|
||||||
|
|||||||
@@ -57,5 +57,5 @@ private:
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "file_helper-inl.h"
|
#include "file_helper-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#ifdef SPDLOG_USE_STD_FORMAT
|
#ifdef SPDLOG_USE_STD_FORMAT
|
||||||
#include <charconv>
|
#include <charconv>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Some fmt helpers to efficiently format and pad ints and strings
|
// Some fmt helpers to efficiently format and pad ints and strings
|
||||||
@@ -70,13 +70,13 @@ inline unsigned int count_digits(T n) {
|
|||||||
return count_digits_fallback(static_cast<count_type>(n));
|
return count_digits_fallback(static_cast<count_type>(n));
|
||||||
#else
|
#else
|
||||||
return static_cast<unsigned int>(fmt::
|
return static_cast<unsigned int>(fmt::
|
||||||
// fmt 7.0.0 renamed the internal namespace to detail.
|
// fmt 7.0.0 renamed the internal namespace to detail.
|
||||||
// See: https://github.com/fmtlib/fmt/issues/1538
|
// See: https://github.com/fmtlib/fmt/issues/1538
|
||||||
#if FMT_VERSION < 70000
|
#if FMT_VERSION < 70000
|
||||||
internal
|
internal
|
||||||
#else
|
#else
|
||||||
detail
|
detail
|
||||||
#endif
|
#endif
|
||||||
::count_digits(static_cast<count_type>(n)));
|
::count_digits(static_cast<count_type>(n)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/details/log_msg.h>
|
#include <spdlog/details/log_msg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/details/os.h>
|
#include <spdlog/details/os.h>
|
||||||
|
|||||||
@@ -36,5 +36,5 @@ struct SPDLOG_API log_msg {
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "log_msg-inl.h"
|
#include "log_msg-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/details/log_msg_buffer.h>
|
#include <spdlog/details/log_msg_buffer.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
|
|||||||
@@ -28,5 +28,5 @@ public:
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "log_msg_buffer-inl.h"
|
#include "log_msg_buffer-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/details/os.h>
|
#include <spdlog/details/os.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/common.h>
|
#include <spdlog/common.h>
|
||||||
@@ -22,50 +22,50 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <spdlog/details/windows_include.h>
|
#include <spdlog/details/windows_include.h>
|
||||||
#include <io.h> // for _get_osfhandle, _isatty, _fileno
|
#include <io.h> // for _get_osfhandle, _isatty, _fileno
|
||||||
#include <process.h> // for _get_pid
|
#include <process.h> // for _get_pid
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
#include <share.h>
|
#include <share.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES)
|
#if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES)
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <direct.h> // for _mkdir/_wmkdir
|
#include <direct.h> // for _mkdir/_wmkdir
|
||||||
|
|
||||||
#else // unix
|
#else // unix
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <sys/syscall.h> //Use gettid() syscall under linux to get thread id
|
#include <sys/syscall.h> //Use gettid() syscall under linux to get thread id
|
||||||
|
|
||||||
#elif defined(_AIX)
|
#elif defined(_AIX)
|
||||||
#include <pthread.h> // for pthread_getthrds_np
|
#include <pthread.h> // for pthread_getthrds_np
|
||||||
|
|
||||||
#elif defined(__DragonFly__) || defined(__FreeBSD__)
|
#elif defined(__DragonFly__) || defined(__FreeBSD__)
|
||||||
#include <pthread_np.h> // for pthread_getthreadid_np
|
#include <pthread_np.h> // for pthread_getthreadid_np
|
||||||
|
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#include <lwp.h> // for _lwp_self
|
#include <lwp.h> // for _lwp_self
|
||||||
|
|
||||||
#elif defined(__sun)
|
#elif defined(__sun)
|
||||||
#include <thread.h> // for thr_self
|
#include <thread.h> // for thr_self
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // unix
|
#endif // unix
|
||||||
|
|
||||||
#if defined __APPLE__
|
#if defined __APPLE__
|
||||||
#include <AvailabilityMacros.h>
|
#include <AvailabilityMacros.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __has_feature // Clang - feature checking macros.
|
#ifndef __has_feature // Clang - feature checking macros.
|
||||||
#define __has_feature(x) 0 // Compatibility with non-clang compilers.
|
#define __has_feature(x) 0 // Compatibility with non-clang compilers.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
@@ -119,12 +119,12 @@ SPDLOG_INLINE std::tm gmtime() SPDLOG_NOEXCEPT {
|
|||||||
// fopen_s on non windows for writing
|
// fopen_s on non windows for writing
|
||||||
SPDLOG_INLINE bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode) {
|
SPDLOG_INLINE bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifdef SPDLOG_WCHAR_FILENAMES
|
#ifdef SPDLOG_WCHAR_FILENAMES
|
||||||
*fp = ::_wfsopen((filename.c_str()), mode.c_str(), _SH_DENYNO);
|
*fp = ::_wfsopen((filename.c_str()), mode.c_str(), _SH_DENYNO);
|
||||||
#else
|
#else
|
||||||
*fp = ::_fsopen((filename.c_str()), mode.c_str(), _SH_DENYNO);
|
*fp = ::_fsopen((filename.c_str()), mode.c_str(), _SH_DENYNO);
|
||||||
#endif
|
#endif
|
||||||
#if defined(SPDLOG_PREVENT_CHILD_FD)
|
#if defined(SPDLOG_PREVENT_CHILD_FD)
|
||||||
if (*fp != nullptr) {
|
if (*fp != nullptr) {
|
||||||
auto file_handle = reinterpret_cast<HANDLE>(_get_osfhandle(::_fileno(*fp)));
|
auto file_handle = reinterpret_cast<HANDLE>(_get_osfhandle(::_fileno(*fp)));
|
||||||
if (!::SetHandleInformation(file_handle, HANDLE_FLAG_INHERIT, 0)) {
|
if (!::SetHandleInformation(file_handle, HANDLE_FLAG_INHERIT, 0)) {
|
||||||
@@ -132,9 +132,9 @@ SPDLOG_INLINE bool fopen_s(FILE **fp, const filename_t &filename, const filename
|
|||||||
*fp = nullptr;
|
*fp = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else // unix
|
#else // unix
|
||||||
#if defined(SPDLOG_PREVENT_CHILD_FD)
|
#if defined(SPDLOG_PREVENT_CHILD_FD)
|
||||||
const int mode_flag = mode == SPDLOG_FILENAME_T("ab") ? O_APPEND : O_TRUNC;
|
const int mode_flag = mode == SPDLOG_FILENAME_T("ab") ? O_APPEND : O_TRUNC;
|
||||||
const int fd =
|
const int fd =
|
||||||
::open((filename.c_str()), O_CREAT | O_WRONLY | O_CLOEXEC | mode_flag, mode_t(0644));
|
::open((filename.c_str()), O_CREAT | O_WRONLY | O_CLOEXEC | mode_flag, mode_t(0644));
|
||||||
@@ -145,9 +145,9 @@ SPDLOG_INLINE bool fopen_s(FILE **fp, const filename_t &filename, const filename
|
|||||||
if (*fp == nullptr) {
|
if (*fp == nullptr) {
|
||||||
::close(fd);
|
::close(fd);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
*fp = ::fopen((filename.c_str()), mode.c_str());
|
*fp = ::fopen((filename.c_str()), mode.c_str());
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return *fp == nullptr;
|
return *fp == nullptr;
|
||||||
@@ -177,11 +177,11 @@ SPDLOG_INLINE int rename(const filename_t &filename1, const filename_t &filename
|
|||||||
SPDLOG_INLINE bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT {
|
SPDLOG_INLINE bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
struct _stat buffer;
|
struct _stat buffer;
|
||||||
#ifdef SPDLOG_WCHAR_FILENAMES
|
#ifdef SPDLOG_WCHAR_FILENAMES
|
||||||
return (::_wstat(filename.c_str(), &buffer) == 0);
|
return (::_wstat(filename.c_str(), &buffer) == 0);
|
||||||
#else
|
#else
|
||||||
return (::_stat(filename.c_str(), &buffer) == 0);
|
return (::_stat(filename.c_str(), &buffer) == 0);
|
||||||
#endif
|
#endif
|
||||||
#else // common linux/unix all have the stat system call
|
#else // common linux/unix all have the stat system call
|
||||||
struct stat buffer;
|
struct stat buffer;
|
||||||
return (::stat(filename.c_str(), &buffer) == 0);
|
return (::stat(filename.c_str(), &buffer) == 0);
|
||||||
@@ -189,9 +189,9 @@ SPDLOG_INLINE bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// avoid warning about unreachable statement at the end of filesize()
|
// avoid warning about unreachable statement at the end of filesize()
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4702)
|
#pragma warning(disable : 4702)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Return file size according to open FILE* object
|
// Return file size according to open FILE* object
|
||||||
@@ -201,59 +201,59 @@ SPDLOG_INLINE size_t filesize(FILE *f) {
|
|||||||
}
|
}
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
int fd = ::_fileno(f);
|
int fd = ::_fileno(f);
|
||||||
#if defined(_WIN64) // 64 bits
|
#if defined(_WIN64) // 64 bits
|
||||||
__int64 ret = ::_filelengthi64(fd);
|
__int64 ret = ::_filelengthi64(fd);
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
return static_cast<size_t>(ret);
|
return static_cast<size_t>(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // windows 32 bits
|
#else // windows 32 bits
|
||||||
long ret = ::_filelength(fd);
|
long ret = ::_filelength(fd);
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
return static_cast<size_t>(ret);
|
return static_cast<size_t>(ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else // unix
|
#else // unix
|
||||||
// OpenBSD and AIX doesn't compile with :: before the fileno(..)
|
// OpenBSD and AIX doesn't compile with :: before the fileno(..)
|
||||||
#if defined(__OpenBSD__) || defined(_AIX)
|
#if defined(__OpenBSD__) || defined(_AIX)
|
||||||
int fd = fileno(f);
|
int fd = fileno(f);
|
||||||
#else
|
#else
|
||||||
int fd = ::fileno(f);
|
int fd = ::fileno(f);
|
||||||
#endif
|
#endif
|
||||||
// 64 bits(but not in osx, linux/musl or cygwin, where fstat64 is deprecated)
|
// 64 bits(but not in osx, linux/musl or cygwin, where fstat64 is deprecated)
|
||||||
#if ((defined(__linux__) && defined(__GLIBC__)) || defined(__sun) || defined(_AIX)) && \
|
#if ((defined(__linux__) && defined(__GLIBC__)) || defined(__sun) || defined(_AIX)) && \
|
||||||
(defined(__LP64__) || defined(_LP64))
|
(defined(__LP64__) || defined(_LP64))
|
||||||
struct stat64 st;
|
struct stat64 st;
|
||||||
if (::fstat64(fd, &st) == 0) {
|
if (::fstat64(fd, &st) == 0) {
|
||||||
return static_cast<size_t>(st.st_size);
|
return static_cast<size_t>(st.st_size);
|
||||||
}
|
}
|
||||||
#else // other unix or linux 32 bits or cygwin
|
#else // other unix or linux 32 bits or cygwin
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (::fstat(fd, &st) == 0) {
|
if (::fstat(fd, &st) == 0) {
|
||||||
return static_cast<size_t>(st.st_size);
|
return static_cast<size_t>(st.st_size);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
throw_spdlog_ex("Failed getting file size from fd", errno);
|
throw_spdlog_ex("Failed getting file size from fd", errno);
|
||||||
return 0; // will not be reached.
|
return 0; // will not be reached.
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Return utc offset in minutes or throw spdlog_ex on failure
|
// Return utc offset in minutes or throw spdlog_ex on failure
|
||||||
#if !defined(SPDLOG_NO_TZ_OFFSET)
|
#if !defined(SPDLOG_NO_TZ_OFFSET)
|
||||||
SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm) {
|
SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#if _WIN32_WINNT < _WIN32_WINNT_WS08
|
#if _WIN32_WINNT < _WIN32_WINNT_WS08
|
||||||
TIME_ZONE_INFORMATION tzinfo;
|
TIME_ZONE_INFORMATION tzinfo;
|
||||||
auto rv = ::GetTimeZoneInformation(&tzinfo);
|
auto rv = ::GetTimeZoneInformation(&tzinfo);
|
||||||
#else
|
#else
|
||||||
DYNAMIC_TIME_ZONE_INFORMATION tzinfo;
|
DYNAMIC_TIME_ZONE_INFORMATION tzinfo;
|
||||||
auto rv = ::GetDynamicTimeZoneInformation(&tzinfo);
|
auto rv = ::GetDynamicTimeZoneInformation(&tzinfo);
|
||||||
#endif
|
#endif
|
||||||
if (rv == TIME_ZONE_ID_INVALID) throw_spdlog_ex("Failed getting timezone info. ", errno);
|
if (rv == TIME_ZONE_ID_INVALID) throw_spdlog_ex("Failed getting timezone info. ", errno);
|
||||||
|
|
||||||
int offset = -tzinfo.Bias;
|
int offset = -tzinfo.Bias;
|
||||||
@@ -263,10 +263,10 @@ SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm) {
|
|||||||
offset -= tzinfo.StandardBias;
|
offset -= tzinfo.StandardBias;
|
||||||
}
|
}
|
||||||
return offset;
|
return offset;
|
||||||
#else
|
#else
|
||||||
auto offset_seconds = tm.tm_gmtoff;
|
auto offset_seconds = tm.tm_gmtoff;
|
||||||
return static_cast<int>(offset_seconds / 60);
|
return static_cast<int>(offset_seconds / 60);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif // SPDLOG_NO_TZ_OFFSET
|
#endif // SPDLOG_NO_TZ_OFFSET
|
||||||
|
|
||||||
@@ -277,9 +277,9 @@ SPDLOG_INLINE size_t _thread_id() SPDLOG_NOEXCEPT {
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return static_cast<size_t>(::GetCurrentThreadId());
|
return static_cast<size_t>(::GetCurrentThreadId());
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
#if defined(__ANDROID__) && defined(__ANDROID_API__) && (__ANDROID_API__ < 21)
|
#if defined(__ANDROID__) && defined(__ANDROID_API__) && (__ANDROID_API__ < 21)
|
||||||
#define SYS_gettid __NR_gettid
|
#define SYS_gettid __NR_gettid
|
||||||
#endif
|
#endif
|
||||||
return static_cast<size_t>(::syscall(SYS_gettid));
|
return static_cast<size_t>(::syscall(SYS_gettid));
|
||||||
#elif defined(_AIX)
|
#elif defined(_AIX)
|
||||||
struct __pthrdsinfo buf;
|
struct __pthrdsinfo buf;
|
||||||
@@ -298,25 +298,25 @@ SPDLOG_INLINE size_t _thread_id() SPDLOG_NOEXCEPT {
|
|||||||
return static_cast<size_t>(::thr_self());
|
return static_cast<size_t>(::thr_self());
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
uint64_t tid;
|
uint64_t tid;
|
||||||
// There is no pthread_threadid_np prior to Mac OS X 10.6, and it is not supported on any PPC,
|
// There is no pthread_threadid_np prior to Mac OS X 10.6, and it is not supported on any PPC,
|
||||||
// including 10.6.8 Rosetta. __POWERPC__ is Apple-specific define encompassing ppc and ppc64.
|
// including 10.6.8 Rosetta. __POWERPC__ is Apple-specific define encompassing ppc and ppc64.
|
||||||
#ifdef MAC_OS_X_VERSION_MAX_ALLOWED
|
#ifdef MAC_OS_X_VERSION_MAX_ALLOWED
|
||||||
{
|
{
|
||||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED < 1060) || defined(__POWERPC__)
|
#if (MAC_OS_X_VERSION_MAX_ALLOWED < 1060) || defined(__POWERPC__)
|
||||||
tid = pthread_mach_thread_np(pthread_self());
|
tid = pthread_mach_thread_np(pthread_self());
|
||||||
#elif MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
#elif MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
||||||
if (&pthread_threadid_np) {
|
if (&pthread_threadid_np) {
|
||||||
pthread_threadid_np(nullptr, &tid);
|
pthread_threadid_np(nullptr, &tid);
|
||||||
} else {
|
} else {
|
||||||
tid = pthread_mach_thread_np(pthread_self());
|
tid = pthread_mach_thread_np(pthread_self());
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
pthread_threadid_np(nullptr, &tid);
|
pthread_threadid_np(nullptr, &tid);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
pthread_threadid_np(nullptr, &tid);
|
pthread_threadid_np(nullptr, &tid);
|
||||||
#endif
|
#endif
|
||||||
return static_cast<size_t>(tid);
|
return static_cast<size_t>(tid);
|
||||||
#else // Default to standard C++11 (other Unix)
|
#else // Default to standard C++11 (other Unix)
|
||||||
return static_cast<size_t>(std::hash<std::thread::id>()(std::this_thread::get_id()));
|
return static_cast<size_t>(std::hash<std::thread::id>()(std::this_thread::get_id()));
|
||||||
@@ -469,11 +469,11 @@ SPDLOG_INLINE void utf8_to_wstrbuf(string_view_t str, wmemory_buf_t &target) {
|
|||||||
// return true on success
|
// return true on success
|
||||||
static SPDLOG_INLINE bool mkdir_(const filename_t &path) {
|
static SPDLOG_INLINE bool mkdir_(const filename_t &path) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifdef SPDLOG_WCHAR_FILENAMES
|
#ifdef SPDLOG_WCHAR_FILENAMES
|
||||||
return ::_wmkdir(path.c_str()) == 0;
|
return ::_wmkdir(path.c_str()) == 0;
|
||||||
#else
|
#else
|
||||||
return ::_mkdir(path.c_str()) == 0;
|
return ::_mkdir(path.c_str()) == 0;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
return ::mkdir(path.c_str(), mode_t(0755)) == 0;
|
return ::mkdir(path.c_str(), mode_t(0755)) == 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -529,8 +529,8 @@ SPDLOG_INLINE filename_t dir_name(const filename_t &path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4996)
|
#pragma warning(disable : 4996)
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
std::string SPDLOG_INLINE getenv(const char *field) {
|
std::string SPDLOG_INLINE getenv(const char *field) {
|
||||||
#if defined(_MSC_VER) && defined(WINAPI_FAMILY) && defined(WINAPI_FAMILY_DESKTOP_APP) && \
|
#if defined(_MSC_VER) && defined(WINAPI_FAMILY) && defined(WINAPI_FAMILY_DESKTOP_APP) && \
|
||||||
@@ -542,7 +542,7 @@ std::string SPDLOG_INLINE getenv(const char *field) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
// Do fsync by FILE handlerpointer
|
// Do fsync by FILE handlerpointer
|
||||||
|
|||||||
@@ -22,22 +22,22 @@ SPDLOG_API std::tm gmtime() SPDLOG_NOEXCEPT;
|
|||||||
|
|
||||||
// eol definition
|
// eol definition
|
||||||
#if !defined(SPDLOG_EOL)
|
#if !defined(SPDLOG_EOL)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define SPDLOG_EOL "\r\n"
|
#define SPDLOG_EOL "\r\n"
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_EOL "\n"
|
#define SPDLOG_EOL "\n"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SPDLOG_CONSTEXPR static const char *default_eol = SPDLOG_EOL;
|
SPDLOG_CONSTEXPR static const char *default_eol = SPDLOG_EOL;
|
||||||
|
|
||||||
// folder separator
|
// folder separator
|
||||||
#if !defined(SPDLOG_FOLDER_SEPS)
|
#if !defined(SPDLOG_FOLDER_SEPS)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define SPDLOG_FOLDER_SEPS "\\/"
|
#define SPDLOG_FOLDER_SEPS "\\/"
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_FOLDER_SEPS "/"
|
#define SPDLOG_FOLDER_SEPS "/"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SPDLOG_CONSTEXPR static const char folder_seps[] = SPDLOG_FOLDER_SEPS;
|
SPDLOG_CONSTEXPR static const char folder_seps[] = SPDLOG_FOLDER_SEPS;
|
||||||
@@ -123,5 +123,5 @@ SPDLOG_API bool fwrite_bytes(const void *ptr, const size_t n_bytes, FILE *fp);
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "os-inl.h"
|
#include "os-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/details/periodic_worker.h>
|
#include <spdlog/details/periodic_worker.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
|
|||||||
@@ -54,5 +54,5 @@ private:
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "periodic_worker-inl.h"
|
#include "periodic_worker-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/details/registry.h>
|
#include <spdlog/details/registry.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/common.h>
|
#include <spdlog/common.h>
|
||||||
@@ -13,12 +13,12 @@
|
|||||||
#include <spdlog/pattern_formatter.h>
|
#include <spdlog/pattern_formatter.h>
|
||||||
|
|
||||||
#ifndef SPDLOG_DISABLE_DEFAULT_LOGGER
|
#ifndef SPDLOG_DISABLE_DEFAULT_LOGGER
|
||||||
// support for the default stdout color logger
|
// support for the default stdout color logger
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <spdlog/sinks/wincolor_sink.h>
|
#include <spdlog/sinks/wincolor_sink.h>
|
||||||
#else
|
#else
|
||||||
#include <spdlog/sinks/ansicolor_sink.h>
|
#include <spdlog/sinks/ansicolor_sink.h>
|
||||||
#endif
|
#endif
|
||||||
#endif // SPDLOG_DISABLE_DEFAULT_LOGGER
|
#endif // SPDLOG_DISABLE_DEFAULT_LOGGER
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -33,12 +33,12 @@ namespace details {
|
|||||||
SPDLOG_INLINE registry::registry()
|
SPDLOG_INLINE registry::registry()
|
||||||
: formatter_(new pattern_formatter()) {
|
: formatter_(new pattern_formatter()) {
|
||||||
#ifndef SPDLOG_DISABLE_DEFAULT_LOGGER
|
#ifndef SPDLOG_DISABLE_DEFAULT_LOGGER
|
||||||
// create default logger (ansicolor_stdout_sink_mt or wincolor_stdout_sink_mt in windows).
|
// create default logger (ansicolor_stdout_sink_mt or wincolor_stdout_sink_mt in windows).
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
auto color_sink = std::make_shared<sinks::wincolor_stdout_sink_mt>();
|
auto color_sink = std::make_shared<sinks::wincolor_stdout_sink_mt>();
|
||||||
#else
|
#else
|
||||||
auto color_sink = std::make_shared<sinks::ansicolor_stdout_sink_mt>();
|
auto color_sink = std::make_shared<sinks::ansicolor_stdout_sink_mt>();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *default_logger_name = "";
|
const char *default_logger_name = "";
|
||||||
default_logger_ = std::make_shared<spdlog::logger>(default_logger_name, std::move(color_sink));
|
default_logger_ = std::make_shared<spdlog::logger>(default_logger_name, std::move(color_sink));
|
||||||
|
|||||||
@@ -127,5 +127,5 @@ private:
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "registry-inl.h"
|
#include "registry-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#error include tcp_client-windows.h instead
|
#error include tcp_client-windows.h instead
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// tcp client helper
|
// tcp client helper
|
||||||
@@ -169,7 +169,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL)
|
#if !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL)
|
||||||
#error "tcp_sink would raise SIGPIPE since neither SO_NOSIGPIPE nor MSG_NOSIGNAL are available"
|
#error "tcp_sink would raise SIGPIPE since neither SO_NOSIGPIPE nor MSG_NOSIGNAL are available"
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/details/thread_pool.h>
|
#include <spdlog/details/thread_pool.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|||||||
@@ -113,5 +113,5 @@ private:
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "thread_pool-inl.h"
|
#include "thread_pool-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -16,9 +16,9 @@
|
|||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma comment(lib, "Ws2_32.lib")
|
#pragma comment(lib, "Ws2_32.lib")
|
||||||
#pragma comment(lib, "Mswsock.lib")
|
#pragma comment(lib, "Mswsock.lib")
|
||||||
#pragma comment(lib, "AdvApi32.lib")
|
#pragma comment(lib, "AdvApi32.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
// Will throw on construction if the socket creation failed.
|
// Will throw on construction if the socket creation failed.
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#error "include udp_client-windows.h instead"
|
#error "include udp_client-windows.h instead"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef NOMINMAX
|
#ifndef NOMINMAX
|
||||||
#define NOMINMAX // prevent windows redefining min/max
|
#define NOMINMAX // prevent windows redefining min/max
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|||||||
@@ -9,13 +9,13 @@
|
|||||||
#include <spdlog/common.h>
|
#include <spdlog/common.h>
|
||||||
|
|
||||||
#if defined(__has_include)
|
#if defined(__has_include)
|
||||||
#if __has_include(<version>)
|
#if __has_include(<version>)
|
||||||
#include <version>
|
#include <version>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __cpp_lib_span >= 202002L
|
#if __cpp_lib_span >= 202002L
|
||||||
#include <span>
|
#include <span>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
#include <spdlog/tweakme.h>
|
#include <spdlog/tweakme.h>
|
||||||
|
|
||||||
#if !defined(SPDLOG_USE_STD_FORMAT)
|
#if !defined(SPDLOG_USE_STD_FORMAT)
|
||||||
#if !defined(SPDLOG_FMT_EXTERNAL)
|
#if !defined(SPDLOG_FMT_EXTERNAL)
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#ifndef FMT_HEADER_ONLY
|
#ifndef FMT_HEADER_ONLY
|
||||||
#define FMT_HEADER_ONLY
|
#define FMT_HEADER_ONLY
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#include <spdlog/fmt/bundled/chrono.h>
|
#include <spdlog/fmt/bundled/chrono.h>
|
||||||
#else
|
#else
|
||||||
#include <fmt/chrono.h>
|
#include <fmt/chrono.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
#include <spdlog/tweakme.h>
|
#include <spdlog/tweakme.h>
|
||||||
|
|
||||||
#if !defined(SPDLOG_USE_STD_FORMAT)
|
#if !defined(SPDLOG_USE_STD_FORMAT)
|
||||||
#if !defined(SPDLOG_FMT_EXTERNAL)
|
#if !defined(SPDLOG_FMT_EXTERNAL)
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#ifndef FMT_HEADER_ONLY
|
#ifndef FMT_HEADER_ONLY
|
||||||
#define FMT_HEADER_ONLY
|
#define FMT_HEADER_ONLY
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#include <spdlog/fmt/bundled/compile.h>
|
#include <spdlog/fmt/bundled/compile.h>
|
||||||
#else
|
#else
|
||||||
#include <fmt/compile.h>
|
#include <fmt/compile.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -12,15 +12,15 @@
|
|||||||
#include <spdlog/tweakme.h>
|
#include <spdlog/tweakme.h>
|
||||||
|
|
||||||
#if defined(SPDLOG_USE_STD_FORMAT) // SPDLOG_USE_STD_FORMAT is defined - use std::format
|
#if defined(SPDLOG_USE_STD_FORMAT) // SPDLOG_USE_STD_FORMAT is defined - use std::format
|
||||||
#include <format>
|
#include <format>
|
||||||
#elif !defined(SPDLOG_FMT_EXTERNAL)
|
#elif !defined(SPDLOG_FMT_EXTERNAL)
|
||||||
#if !defined(SPDLOG_COMPILED_LIB) && !defined(FMT_HEADER_ONLY)
|
#if !defined(SPDLOG_COMPILED_LIB) && !defined(FMT_HEADER_ONLY)
|
||||||
#define FMT_HEADER_ONLY
|
#define FMT_HEADER_ONLY
|
||||||
#endif
|
#endif
|
||||||
#ifndef FMT_USE_WINDOWS_H
|
#ifndef FMT_USE_WINDOWS_H
|
||||||
#define FMT_USE_WINDOWS_H 0
|
#define FMT_USE_WINDOWS_H 0
|
||||||
#endif
|
#endif
|
||||||
#include <spdlog/fmt/bundled/format.h>
|
#include <spdlog/fmt/bundled/format.h>
|
||||||
#else // SPDLOG_FMT_EXTERNAL is defined - use external fmtlib
|
#else // SPDLOG_FMT_EXTERNAL is defined - use external fmtlib
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
#include <spdlog/tweakme.h>
|
#include <spdlog/tweakme.h>
|
||||||
|
|
||||||
#if !defined(SPDLOG_USE_STD_FORMAT)
|
#if !defined(SPDLOG_USE_STD_FORMAT)
|
||||||
#if !defined(SPDLOG_FMT_EXTERNAL)
|
#if !defined(SPDLOG_FMT_EXTERNAL)
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#ifndef FMT_HEADER_ONLY
|
#ifndef FMT_HEADER_ONLY
|
||||||
#define FMT_HEADER_ONLY
|
#define FMT_HEADER_ONLY
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#include <spdlog/fmt/bundled/ostream.h>
|
#include <spdlog/fmt/bundled/ostream.h>
|
||||||
#else
|
#else
|
||||||
#include <fmt/ostream.h>
|
#include <fmt/ostream.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
#include <spdlog/tweakme.h>
|
#include <spdlog/tweakme.h>
|
||||||
|
|
||||||
#if !defined(SPDLOG_USE_STD_FORMAT)
|
#if !defined(SPDLOG_USE_STD_FORMAT)
|
||||||
#if !defined(SPDLOG_FMT_EXTERNAL)
|
#if !defined(SPDLOG_FMT_EXTERNAL)
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#ifndef FMT_HEADER_ONLY
|
#ifndef FMT_HEADER_ONLY
|
||||||
#define FMT_HEADER_ONLY
|
#define FMT_HEADER_ONLY
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#include <spdlog/fmt/bundled/ranges.h>
|
#include <spdlog/fmt/bundled/ranges.h>
|
||||||
#else
|
#else
|
||||||
#include <fmt/ranges.h>
|
#include <fmt/ranges.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -11,14 +11,14 @@
|
|||||||
#include <spdlog/tweakme.h>
|
#include <spdlog/tweakme.h>
|
||||||
|
|
||||||
#if !defined(SPDLOG_USE_STD_FORMAT)
|
#if !defined(SPDLOG_USE_STD_FORMAT)
|
||||||
#if !defined(SPDLOG_FMT_EXTERNAL)
|
#if !defined(SPDLOG_FMT_EXTERNAL)
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#ifndef FMT_HEADER_ONLY
|
#ifndef FMT_HEADER_ONLY
|
||||||
#define FMT_HEADER_ONLY
|
#define FMT_HEADER_ONLY
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#include <spdlog/fmt/bundled/std.h>
|
#include <spdlog/fmt/bundled/std.h>
|
||||||
#else
|
#else
|
||||||
#include <fmt/std.h>
|
#include <fmt/std.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
#include <spdlog/tweakme.h>
|
#include <spdlog/tweakme.h>
|
||||||
|
|
||||||
#if !defined(SPDLOG_USE_STD_FORMAT)
|
#if !defined(SPDLOG_USE_STD_FORMAT)
|
||||||
#if !defined(SPDLOG_FMT_EXTERNAL)
|
#if !defined(SPDLOG_FMT_EXTERNAL)
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#ifndef FMT_HEADER_ONLY
|
#ifndef FMT_HEADER_ONLY
|
||||||
#define FMT_HEADER_ONLY
|
#define FMT_HEADER_ONLY
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#include <spdlog/fmt/bundled/xchar.h>
|
#include <spdlog/fmt/bundled/xchar.h>
|
||||||
#else
|
#else
|
||||||
#include <fmt/xchar.h>
|
#include <fmt/xchar.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/logger.h>
|
#include <spdlog/logger.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/details/backtracer.h>
|
#include <spdlog/details/backtracer.h>
|
||||||
|
|||||||
@@ -19,16 +19,16 @@
|
|||||||
#include <spdlog/details/log_msg.h>
|
#include <spdlog/details/log_msg.h>
|
||||||
|
|
||||||
#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
|
||||||
#endif
|
#endif
|
||||||
#include <spdlog/details/os.h>
|
#include <spdlog/details/os.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifndef SPDLOG_NO_EXCEPTIONS
|
#ifndef SPDLOG_NO_EXCEPTIONS
|
||||||
#define SPDLOG_LOGGER_CATCH(location) \
|
#define SPDLOG_LOGGER_CATCH(location) \
|
||||||
catch (const std::exception &ex) { \
|
catch (const std::exception &ex) { \
|
||||||
if (location.filename) { \
|
if (location.filename) { \
|
||||||
err_handler_(fmt_lib::format(SPDLOG_FMT_STRING("{} [{}({})]"), ex.what(), \
|
err_handler_(fmt_lib::format(SPDLOG_FMT_STRING("{} [{}({})]"), ex.what(), \
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
throw; \
|
throw; \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_LOGGER_CATCH(location)
|
#define SPDLOG_LOGGER_CATCH(location)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
@@ -375,5 +375,5 @@ void swap(logger &a, logger &b) noexcept;
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "logger-inl.h"
|
#include "logger-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if defined(SPDLOG_NO_TLS)
|
#if defined(SPDLOG_NO_TLS)
|
||||||
#error "This header requires thread local storage support, but SPDLOG_NO_TLS is defined."
|
#error "This header requires thread local storage support, but SPDLOG_NO_TLS is defined."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/pattern_formatter.h>
|
#include <spdlog/pattern_formatter.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/details/fmt_helper.h>
|
#include <spdlog/details/fmt_helper.h>
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <spdlog/details/os.h>
|
#include <spdlog/details/os.h>
|
||||||
|
|
||||||
#ifndef SPDLOG_NO_TLS
|
#ifndef SPDLOG_NO_TLS
|
||||||
#include <spdlog/mdc.h>
|
#include <spdlog/mdc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/fmt/fmt.h>
|
#include <spdlog/fmt/fmt.h>
|
||||||
@@ -702,8 +702,8 @@ public:
|
|||||||
: flag_formatter(padinfo) {}
|
: flag_formatter(padinfo) {}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4127) // consider using 'if constexpr' instead
|
#pragma warning(disable : 4127) // consider using 'if constexpr' instead
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
static const char *basename(const char *filename) {
|
static const char *basename(const char *filename) {
|
||||||
// if the size is 2 (1 character + null terminator) we can use the more efficient strrchr
|
// if the size is 2 (1 character + null terminator) we can use the more efficient strrchr
|
||||||
@@ -721,7 +721,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override {
|
void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override {
|
||||||
|
|||||||
@@ -114,5 +114,5 @@ private:
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "pattern_formatter-inl.h"
|
#include "pattern_formatter-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,22 +5,22 @@
|
|||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
|
|
||||||
#include <spdlog/details/fmt_helper.h>
|
#include <spdlog/details/fmt_helper.h>
|
||||||
#include <spdlog/details/null_mutex.h>
|
#include <spdlog/details/null_mutex.h>
|
||||||
#include <spdlog/details/os.h>
|
#include <spdlog/details/os.h>
|
||||||
#include <spdlog/details/synchronous_factory.h>
|
#include <spdlog/details/synchronous_factory.h>
|
||||||
#include <spdlog/sinks/base_sink.h>
|
#include <spdlog/sinks/base_sink.h>
|
||||||
|
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#if !defined(SPDLOG_ANDROID_RETRIES)
|
#if !defined(SPDLOG_ANDROID_RETRIES)
|
||||||
#define SPDLOG_ANDROID_RETRIES 2
|
#define SPDLOG_ANDROID_RETRIES 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
namespace sinks {
|
namespace sinks {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/sinks/ansicolor_sink.h>
|
#include <spdlog/sinks/ansicolor_sink.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/details/os.h>
|
#include <spdlog/details/os.h>
|
||||||
|
|||||||
@@ -114,5 +114,5 @@ using ansicolor_stderr_sink_st = ansicolor_stderr_sink<details::console_nullmute
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "ansicolor_sink-inl.h"
|
#include "ansicolor_sink-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/sinks/base_sink.h>
|
#include <spdlog/sinks/base_sink.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/common.h>
|
#include <spdlog/common.h>
|
||||||
|
|||||||
@@ -47,5 +47,5 @@ protected:
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "base_sink-inl.h"
|
#include "base_sink-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/sinks/basic_file_sink.h>
|
#include <spdlog/sinks/basic_file_sink.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/common.h>
|
#include <spdlog/common.h>
|
||||||
|
|||||||
@@ -62,5 +62,5 @@ inline std::shared_ptr<logger> basic_logger_st(const std::string &logger_name,
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "basic_file_sink-inl.h"
|
#include "basic_file_sink-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,21 +5,21 @@
|
|||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
#include <spdlog/details/null_mutex.h>
|
#include <spdlog/details/null_mutex.h>
|
||||||
#if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
#if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
||||||
#include <spdlog/details/os.h>
|
#include <spdlog/details/os.h>
|
||||||
#endif
|
#endif
|
||||||
#include <spdlog/sinks/base_sink.h>
|
#include <spdlog/sinks/base_sink.h>
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
// Avoid including windows.h (https://stackoverflow.com/a/30741042)
|
// Avoid including windows.h (https://stackoverflow.com/a/30741042)
|
||||||
#if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
#if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
||||||
extern "C" __declspec(dllimport) void __stdcall OutputDebugStringW(const wchar_t *lpOutputString);
|
extern "C" __declspec(dllimport) void __stdcall OutputDebugStringW(const wchar_t *lpOutputString);
|
||||||
#else
|
#else
|
||||||
extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char *lpOutputString);
|
extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char *lpOutputString);
|
||||||
#endif
|
#endif
|
||||||
extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
|
extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
|
||||||
|
|
||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
@@ -42,13 +42,13 @@ protected:
|
|||||||
memory_buf_t formatted;
|
memory_buf_t formatted;
|
||||||
base_sink<Mutex>::formatter_->format(msg, formatted);
|
base_sink<Mutex>::formatter_->format(msg, formatted);
|
||||||
formatted.push_back('\0'); // add a null terminator for OutputDebugString
|
formatted.push_back('\0'); // add a null terminator for OutputDebugString
|
||||||
#if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
#if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
||||||
wmemory_buf_t wformatted;
|
wmemory_buf_t wformatted;
|
||||||
details::os::utf8_to_wstrbuf(string_view_t(formatted.data(), formatted.size()), wformatted);
|
details::os::utf8_to_wstrbuf(string_view_t(formatted.data(), formatted.size()), wformatted);
|
||||||
OutputDebugStringW(wformatted.data());
|
OutputDebugStringW(wformatted.data());
|
||||||
#else
|
#else
|
||||||
OutputDebugStringA(formatted.data());
|
OutputDebugStringA(formatted.data());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void flush_() override {}
|
void flush_() override {}
|
||||||
|
|||||||
@@ -160,8 +160,12 @@ protected:
|
|||||||
payload = QString::fromUtf8(str.data(), static_cast<int>(str.size()));
|
payload = QString::fromUtf8(str.data(), static_cast<int>(str.size()));
|
||||||
// convert color ranges from byte index to character index.
|
// convert color ranges from byte index to character index.
|
||||||
if (msg.color_range_start < msg.color_range_end) {
|
if (msg.color_range_start < msg.color_range_end) {
|
||||||
color_range_start = QString::fromUtf8(str.data(), static_cast<qsizetype>(msg.color_range_start)).size();
|
color_range_start =
|
||||||
color_range_end = QString::fromUtf8(str.data(), static_cast<qsizetype>(msg.color_range_end)).size();
|
QString::fromUtf8(str.data(), static_cast<qsizetype>(msg.color_range_start))
|
||||||
|
.size();
|
||||||
|
color_range_end =
|
||||||
|
QString::fromUtf8(str.data(), static_cast<qsizetype>(msg.color_range_end))
|
||||||
|
.size();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
payload = QString::fromLatin1(str.data(), static_cast<int>(str.size()));
|
payload = QString::fromLatin1(str.data(), static_cast<int>(str.size()));
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/sinks/rotating_file_sink.h>
|
#include <spdlog/sinks/rotating_file_sink.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/common.h>
|
#include <spdlog/common.h>
|
||||||
|
|||||||
@@ -89,5 +89,5 @@ std::shared_ptr<logger> rotating_logger_st(const std::string &logger_name,
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "rotating_file_sink-inl.h"
|
#include "rotating_file_sink-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/sinks/sink.h>
|
#include <spdlog/sinks/sink.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/common.h>
|
#include <spdlog/common.h>
|
||||||
|
|||||||
@@ -30,5 +30,5 @@ protected:
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "sink-inl.h"
|
#include "sink-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/sinks/stdout_color_sinks.h>
|
#include <spdlog/sinks/stdout_color_sinks.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/common.h>
|
#include <spdlog/common.h>
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <spdlog/sinks/wincolor_sink.h>
|
#include <spdlog/sinks/wincolor_sink.h>
|
||||||
#else
|
#else
|
||||||
#include <spdlog/sinks/ansicolor_sink.h>
|
#include <spdlog/sinks/ansicolor_sink.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/details/synchronous_factory.h>
|
#include <spdlog/details/synchronous_factory.h>
|
||||||
@@ -45,5 +45,5 @@ std::shared_ptr<logger> stderr_color_st(const std::string &logger_name,
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "stdout_color_sinks-inl.h"
|
#include "stdout_color_sinks-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/sinks/stdout_sinks.h>
|
#include <spdlog/sinks/stdout_sinks.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -13,16 +13,16 @@
|
|||||||
#include <spdlog/details/os.h>
|
#include <spdlog/details/os.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// under windows using fwrite to non-binary stream results in \r\r\n (see issue #1675)
|
// under windows using fwrite to non-binary stream results in \r\r\n (see issue #1675)
|
||||||
// so instead we use ::FileWrite
|
// so instead we use ::FileWrite
|
||||||
#include <spdlog/details/windows_include.h>
|
#include <spdlog/details/windows_include.h>
|
||||||
|
|
||||||
#ifndef _USING_V110_SDK71_ // fileapi.h doesn't exist in winxp
|
#ifndef _USING_V110_SDK71_ // fileapi.h doesn't exist in winxp
|
||||||
#include <fileapi.h> // WriteFile (..)
|
#include <fileapi.h> // WriteFile (..)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <io.h> // _get_osfhandle(..)
|
#include <io.h> // _get_osfhandle(..)
|
||||||
#include <stdio.h> // _fileno(..)
|
#include <stdio.h> // _fileno(..)
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <spdlog/sinks/sink.h>
|
#include <spdlog/sinks/sink.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <spdlog/details/windows_include.h>
|
#include <spdlog/details/windows_include.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
@@ -80,5 +80,5 @@ std::shared_ptr<logger> stderr_logger_st(const std::string &logger_name);
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "stdout_sinks-inl.h"
|
#include "stdout_sinks-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#ifndef SD_JOURNAL_SUPPRESS_LOCATION
|
#ifndef SD_JOURNAL_SUPPRESS_LOCATION
|
||||||
#define SD_JOURNAL_SUPPRESS_LOCATION
|
#define SD_JOURNAL_SUPPRESS_LOCATION
|
||||||
#endif
|
#endif
|
||||||
#include <systemd/sd-journal.h>
|
#include <systemd/sd-journal.h>
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
#include <spdlog/details/null_mutex.h>
|
#include <spdlog/details/null_mutex.h>
|
||||||
#include <spdlog/sinks/base_sink.h>
|
#include <spdlog/sinks/base_sink.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <spdlog/details/tcp_client-windows.h>
|
#include <spdlog/details/tcp_client-windows.h>
|
||||||
#else
|
#else
|
||||||
#include <spdlog/details/tcp_client.h>
|
#include <spdlog/details/tcp_client.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
#include <spdlog/details/null_mutex.h>
|
#include <spdlog/details/null_mutex.h>
|
||||||
#include <spdlog/sinks/base_sink.h>
|
#include <spdlog/sinks/base_sink.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <spdlog/details/udp_client-windows.h>
|
#include <spdlog/details/udp_client-windows.h>
|
||||||
#else
|
#else
|
||||||
#include <spdlog/details/udp_client.h>
|
#include <spdlog/details/udp_client.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/sinks/wincolor_sink.h>
|
#include <spdlog/sinks/wincolor_sink.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/details/windows_include.h>
|
#include <spdlog/details/windows_include.h>
|
||||||
|
|||||||
@@ -78,5 +78,5 @@ using wincolor_stderr_sink_st = wincolor_stderr_sink<details::console_nullmutex>
|
|||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "wincolor_sink-inl.h"
|
#include "wincolor_sink-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef SPDLOG_HEADER_ONLY
|
#ifndef SPDLOG_HEADER_ONLY
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/common.h>
|
#include <spdlog/common.h>
|
||||||
|
|||||||
@@ -289,69 +289,66 @@ inline void critical(const T &msg) {
|
|||||||
//
|
//
|
||||||
|
|
||||||
#ifndef SPDLOG_NO_SOURCE_LOC
|
#ifndef SPDLOG_NO_SOURCE_LOC
|
||||||
#define SPDLOG_LOGGER_CALL(logger, level, ...) \
|
#define SPDLOG_LOGGER_CALL(logger, level, ...) \
|
||||||
(logger)->log(spdlog::source_loc{__FILE__, __LINE__, SPDLOG_FUNCTION}, level, __VA_ARGS__)
|
(logger)->log(spdlog::source_loc{__FILE__, __LINE__, SPDLOG_FUNCTION}, level, __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_LOGGER_CALL(logger, level, ...) \
|
#define SPDLOG_LOGGER_CALL(logger, level, ...) \
|
||||||
(logger)->log(spdlog::source_loc{}, level, __VA_ARGS__)
|
(logger)->log(spdlog::source_loc{}, level, __VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_TRACE
|
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_TRACE
|
||||||
#define SPDLOG_LOGGER_TRACE(logger, ...) \
|
#define SPDLOG_LOGGER_TRACE(logger, ...) \
|
||||||
SPDLOG_LOGGER_CALL(logger, spdlog::level::trace, __VA_ARGS__)
|
SPDLOG_LOGGER_CALL(logger, spdlog::level::trace, __VA_ARGS__)
|
||||||
#define SPDLOG_TRACE(...) SPDLOG_LOGGER_TRACE(spdlog::default_logger_raw(), __VA_ARGS__)
|
#define SPDLOG_TRACE(...) SPDLOG_LOGGER_TRACE(spdlog::default_logger_raw(), __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_LOGGER_TRACE(logger, ...) (void)0
|
#define SPDLOG_LOGGER_TRACE(logger, ...) (void)0
|
||||||
#define SPDLOG_TRACE(...) (void)0
|
#define SPDLOG_TRACE(...) (void)0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_DEBUG
|
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_DEBUG
|
||||||
#define SPDLOG_LOGGER_DEBUG(logger, ...) \
|
#define SPDLOG_LOGGER_DEBUG(logger, ...) \
|
||||||
SPDLOG_LOGGER_CALL(logger, spdlog::level::debug, __VA_ARGS__)
|
SPDLOG_LOGGER_CALL(logger, spdlog::level::debug, __VA_ARGS__)
|
||||||
#define SPDLOG_DEBUG(...) SPDLOG_LOGGER_DEBUG(spdlog::default_logger_raw(), __VA_ARGS__)
|
#define SPDLOG_DEBUG(...) SPDLOG_LOGGER_DEBUG(spdlog::default_logger_raw(), __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_LOGGER_DEBUG(logger, ...) (void)0
|
#define SPDLOG_LOGGER_DEBUG(logger, ...) (void)0
|
||||||
#define SPDLOG_DEBUG(...) (void)0
|
#define SPDLOG_DEBUG(...) (void)0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_INFO
|
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_INFO
|
||||||
#define SPDLOG_LOGGER_INFO(logger, ...) \
|
#define SPDLOG_LOGGER_INFO(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::info, __VA_ARGS__)
|
||||||
SPDLOG_LOGGER_CALL(logger, spdlog::level::info, __VA_ARGS__)
|
#define SPDLOG_INFO(...) SPDLOG_LOGGER_INFO(spdlog::default_logger_raw(), __VA_ARGS__)
|
||||||
#define SPDLOG_INFO(...) SPDLOG_LOGGER_INFO(spdlog::default_logger_raw(), __VA_ARGS__)
|
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_LOGGER_INFO(logger, ...) (void)0
|
#define SPDLOG_LOGGER_INFO(logger, ...) (void)0
|
||||||
#define SPDLOG_INFO(...) (void)0
|
#define SPDLOG_INFO(...) (void)0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_WARN
|
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_WARN
|
||||||
#define SPDLOG_LOGGER_WARN(logger, ...) \
|
#define SPDLOG_LOGGER_WARN(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::warn, __VA_ARGS__)
|
||||||
SPDLOG_LOGGER_CALL(logger, spdlog::level::warn, __VA_ARGS__)
|
#define SPDLOG_WARN(...) SPDLOG_LOGGER_WARN(spdlog::default_logger_raw(), __VA_ARGS__)
|
||||||
#define SPDLOG_WARN(...) SPDLOG_LOGGER_WARN(spdlog::default_logger_raw(), __VA_ARGS__)
|
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_LOGGER_WARN(logger, ...) (void)0
|
#define SPDLOG_LOGGER_WARN(logger, ...) (void)0
|
||||||
#define SPDLOG_WARN(...) (void)0
|
#define SPDLOG_WARN(...) (void)0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_ERROR
|
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_ERROR
|
||||||
#define SPDLOG_LOGGER_ERROR(logger, ...) \
|
#define SPDLOG_LOGGER_ERROR(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::err, __VA_ARGS__)
|
||||||
SPDLOG_LOGGER_CALL(logger, spdlog::level::err, __VA_ARGS__)
|
#define SPDLOG_ERROR(...) SPDLOG_LOGGER_ERROR(spdlog::default_logger_raw(), __VA_ARGS__)
|
||||||
#define SPDLOG_ERROR(...) SPDLOG_LOGGER_ERROR(spdlog::default_logger_raw(), __VA_ARGS__)
|
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_LOGGER_ERROR(logger, ...) (void)0
|
#define SPDLOG_LOGGER_ERROR(logger, ...) (void)0
|
||||||
#define SPDLOG_ERROR(...) (void)0
|
#define SPDLOG_ERROR(...) (void)0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_CRITICAL
|
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_CRITICAL
|
||||||
#define SPDLOG_LOGGER_CRITICAL(logger, ...) \
|
#define SPDLOG_LOGGER_CRITICAL(logger, ...) \
|
||||||
SPDLOG_LOGGER_CALL(logger, spdlog::level::critical, __VA_ARGS__)
|
SPDLOG_LOGGER_CALL(logger, spdlog::level::critical, __VA_ARGS__)
|
||||||
#define SPDLOG_CRITICAL(...) SPDLOG_LOGGER_CRITICAL(spdlog::default_logger_raw(), __VA_ARGS__)
|
#define SPDLOG_CRITICAL(...) SPDLOG_LOGGER_CRITICAL(spdlog::default_logger_raw(), __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_LOGGER_CRITICAL(logger, ...) (void)0
|
#define SPDLOG_LOGGER_CRITICAL(logger, ...) (void)0
|
||||||
#define SPDLOG_CRITICAL(...) (void)0
|
#define SPDLOG_CRITICAL(...) (void)0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SPDLOG_HEADER_ONLY
|
#ifdef SPDLOG_HEADER_ONLY
|
||||||
#include "spdlog-inl.h"
|
#include "spdlog-inl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // SPDLOG_H
|
#endif // SPDLOG_H
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
#ifndef SPDLOG_COMPILED_LIB
|
#ifndef SPDLOG_COMPILED_LIB
|
||||||
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/async.h>
|
#include <spdlog/async.h>
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
|
||||||
#ifndef SPDLOG_COMPILED_LIB
|
#ifndef SPDLOG_COMPILED_LIB
|
||||||
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(SPDLOG_FMT_EXTERNAL) && !defined(SPDLOG_USE_STD_FORMAT)
|
#if !defined(SPDLOG_FMT_EXTERNAL) && !defined(SPDLOG_USE_STD_FORMAT)
|
||||||
|
|
||||||
#include <spdlog/fmt/bundled/format-inl.h>
|
#include <spdlog/fmt/bundled/format-inl.h>
|
||||||
|
|
||||||
FMT_BEGIN_NAMESPACE
|
FMT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@@ -19,15 +19,12 @@ template FMT_API auto locale_ref::get<std::locale>() const -> std::locale;
|
|||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template FMT_API auto dragonbox::to_decimal(float x) noexcept
|
template FMT_API auto dragonbox::to_decimal(float x) noexcept -> dragonbox::decimal_fp<float>;
|
||||||
-> dragonbox::decimal_fp<float>;
|
template FMT_API auto dragonbox::to_decimal(double x) noexcept -> dragonbox::decimal_fp<double>;
|
||||||
template FMT_API auto dragonbox::to_decimal(double x) noexcept
|
|
||||||
-> dragonbox::decimal_fp<double>;
|
|
||||||
|
|
||||||
// Explicit instantiations for char.
|
// Explicit instantiations for char.
|
||||||
|
|
||||||
template FMT_API auto thousands_sep_impl(locale_ref)
|
template FMT_API auto thousands_sep_impl(locale_ref) -> thousands_sep_result<char>;
|
||||||
-> thousands_sep_result<char>;
|
|
||||||
template FMT_API auto decimal_point_impl(locale_ref) -> char;
|
template FMT_API auto decimal_point_impl(locale_ref) -> char;
|
||||||
|
|
||||||
// DEPRECATED!
|
// DEPRECATED!
|
||||||
@@ -35,8 +32,7 @@ template FMT_API void buffer<char>::append(const char*, const char*);
|
|||||||
|
|
||||||
// Explicit instantiations for wchar_t.
|
// Explicit instantiations for wchar_t.
|
||||||
|
|
||||||
template FMT_API auto thousands_sep_impl(locale_ref)
|
template FMT_API auto thousands_sep_impl(locale_ref) -> thousands_sep_result<wchar_t>;
|
||||||
-> thousands_sep_result<wchar_t>;
|
|
||||||
template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t;
|
template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t;
|
||||||
|
|
||||||
// DEPRECATED!
|
// DEPRECATED!
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
#ifndef SPDLOG_COMPILED_LIB
|
#ifndef SPDLOG_COMPILED_LIB
|
||||||
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/cfg/helpers-inl.h>
|
#include <spdlog/cfg/helpers-inl.h>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
#ifndef SPDLOG_COMPILED_LIB
|
#ifndef SPDLOG_COMPILED_LIB
|
||||||
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
// color sinks
|
// color sinks
|
||||||
//
|
//
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <spdlog/sinks/wincolor_sink-inl.h>
|
#include <spdlog/sinks/wincolor_sink-inl.h>
|
||||||
template class SPDLOG_API spdlog::sinks::wincolor_sink<spdlog::details::console_mutex>;
|
template class SPDLOG_API spdlog::sinks::wincolor_sink<spdlog::details::console_mutex>;
|
||||||
template class SPDLOG_API spdlog::sinks::wincolor_sink<spdlog::details::console_nullmutex>;
|
template class SPDLOG_API spdlog::sinks::wincolor_sink<spdlog::details::console_nullmutex>;
|
||||||
template class SPDLOG_API spdlog::sinks::wincolor_stdout_sink<spdlog::details::console_mutex>;
|
template class SPDLOG_API spdlog::sinks::wincolor_stdout_sink<spdlog::details::console_mutex>;
|
||||||
@@ -21,7 +21,7 @@ template class SPDLOG_API spdlog::sinks::wincolor_stdout_sink<spdlog::details::c
|
|||||||
template class SPDLOG_API spdlog::sinks::wincolor_stderr_sink<spdlog::details::console_mutex>;
|
template class SPDLOG_API spdlog::sinks::wincolor_stderr_sink<spdlog::details::console_mutex>;
|
||||||
template class SPDLOG_API spdlog::sinks::wincolor_stderr_sink<spdlog::details::console_nullmutex>;
|
template class SPDLOG_API spdlog::sinks::wincolor_stderr_sink<spdlog::details::console_nullmutex>;
|
||||||
#else
|
#else
|
||||||
#include "spdlog/sinks/ansicolor_sink-inl.h"
|
#include "spdlog/sinks/ansicolor_sink-inl.h"
|
||||||
template class SPDLOG_API spdlog::sinks::ansicolor_sink<spdlog::details::console_mutex>;
|
template class SPDLOG_API spdlog::sinks::ansicolor_sink<spdlog::details::console_mutex>;
|
||||||
template class SPDLOG_API spdlog::sinks::ansicolor_sink<spdlog::details::console_nullmutex>;
|
template class SPDLOG_API spdlog::sinks::ansicolor_sink<spdlog::details::console_nullmutex>;
|
||||||
template class SPDLOG_API spdlog::sinks::ansicolor_stdout_sink<spdlog::details::console_mutex>;
|
template class SPDLOG_API spdlog::sinks::ansicolor_stdout_sink<spdlog::details::console_mutex>;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
#ifndef SPDLOG_COMPILED_LIB
|
#ifndef SPDLOG_COMPILED_LIB
|
||||||
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/details/file_helper-inl.h>
|
#include <spdlog/details/file_helper-inl.h>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
#ifndef SPDLOG_COMPILED_LIB
|
#ifndef SPDLOG_COMPILED_LIB
|
||||||
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spdlog/common-inl.h>
|
#include <spdlog/common-inl.h>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
#ifndef SPDLOG_COMPILED_LIB
|
#ifndef SPDLOG_COMPILED_LIB
|
||||||
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if defined(__GNUC__) && __GNUC__ == 12
|
#if defined(__GNUC__) && __GNUC__ == 12
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12
|
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12
|
||||||
#endif
|
#endif
|
||||||
#include <catch2/catch_all.hpp>
|
#include <catch2/catch_all.hpp>
|
||||||
#if defined(__GNUC__) && __GNUC__ == 12
|
#if defined(__GNUC__) && __GNUC__ == 12
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
#include "spdlog/details/os.h"
|
#include "spdlog/details/os.h"
|
||||||
|
|
||||||
#ifndef SPDLOG_NO_TLS
|
#ifndef SPDLOG_NO_TLS
|
||||||
#include "spdlog/mdc.h"
|
#include "spdlog/mdc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "spdlog/sinks/basic_file_sink.h"
|
#include "spdlog/sinks/basic_file_sink.h"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#if defined(__GNUC__) && __GNUC__ == 12
|
#if defined(__GNUC__) && __GNUC__ == 12
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12
|
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <catch2/catch_all.hpp>
|
#include <catch2/catch_all.hpp>
|
||||||
|
|
||||||
#if defined(__GNUC__) && __GNUC__ == 12
|
#if defined(__GNUC__) && __GNUC__ == 12
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -84,11 +84,11 @@ TEST_CASE("dir_name", "[create_dir]") {
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
//
|
//
|
||||||
// test windows cases when drive letter is given e.g. C:\\some-folder
|
// test windows cases when drive letter is given e.g. C:\\some-folder
|
||||||
//
|
//
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <fileapi.h>
|
#include <fileapi.h>
|
||||||
|
|
||||||
std::string get_full_path(const std::string &relative_folder_path) {
|
std::string get_full_path(const std::string &relative_folder_path) {
|
||||||
char full_path[MAX_PATH];
|
char full_path[MAX_PATH];
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ TEST_CASE("rotating_file_sink::calc_filename3", "[rotating_file_sink]") {
|
|||||||
// regex supported only from gcc 4.9 and above
|
// regex supported only from gcc 4.9 and above
|
||||||
#if defined(_MSC_VER) || !(__GNUC__ <= 4 && __GNUC_MINOR__ < 9)
|
#if defined(_MSC_VER) || !(__GNUC__ <= 4 && __GNUC_MINOR__ < 9)
|
||||||
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
TEST_CASE("daily_file_sink::daily_filename_calculator", "[daily_file_sink]") {
|
TEST_CASE("daily_file_sink::daily_filename_calculator", "[daily_file_sink]") {
|
||||||
// daily_YYYY-MM-DD_hh-mm.txt
|
// daily_YYYY-MM-DD_hh-mm.txt
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#if _WIN32
|
#if _WIN32
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
#include "test_sink.h"
|
#include "test_sink.h"
|
||||||
|
|
||||||
#include "spdlog/sinks/win_eventlog_sink.h"
|
#include "spdlog/sinks/win_eventlog_sink.h"
|
||||||
|
|
||||||
static const LPCSTR TEST_SOURCE = "spdlog_test";
|
static const LPCSTR TEST_SOURCE = "spdlog_test";
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
|
||||||
#if SPDLOG_ACTIVE_LEVEL != SPDLOG_LEVEL_DEBUG
|
#if SPDLOG_ACTIVE_LEVEL != SPDLOG_LEVEL_DEBUG
|
||||||
#error "Invalid SPDLOG_ACTIVE_LEVEL in test. Should be SPDLOG_LEVEL_DEBUG"
|
#error "Invalid SPDLOG_ACTIVE_LEVEL in test. Should be SPDLOG_LEVEL_DEBUG"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TEST_FILENAME "test_logs/simple_log"
|
#define TEST_FILENAME "test_logs/simple_log"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifdef _WIN32 // to prevent fopen warning on windows
|
#ifdef _WIN32 // to prevent fopen warning on windows
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void prepare_logdir() {
|
void prepare_logdir() {
|
||||||
|
|||||||
Reference in New Issue
Block a user