mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-27 03:00:46 +08:00
Removed tweak options and spdlog_config.h
This commit is contained in:
parent
21e0810791
commit
3c9963a495
@ -76,7 +76,6 @@ option(SPDLOG_BUILD_WARNINGS "Enable compiler warnings" OFF)
|
|||||||
option(SPDLOG_SYSTEM_INCLUDES "Include as system headers (skip for clang-tidy)." OFF)
|
option(SPDLOG_SYSTEM_INCLUDES "Include as system headers (skip for clang-tidy)." OFF)
|
||||||
option(SPDLOG_INSTALL "Generate the install target" ${SPDLOG_MASTER_PROJECT})
|
option(SPDLOG_INSTALL "Generate the install target" ${SPDLOG_MASTER_PROJECT})
|
||||||
option(SPDLOG_FMT_EXTERNAL "Use external fmt library instead of of fetching from gitub." OFF)
|
option(SPDLOG_FMT_EXTERNAL "Use external fmt library instead of of fetching from gitub." OFF)
|
||||||
option(SPDLOG_NO_EXCEPTIONS "Compile with -fno-exceptions. Call abort() on any spdlog exceptions" OFF)
|
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
option(SPDLOG_CLOCK_COARSE "Use CLOCK_REALTIME_COARSE instead of the regular clock," OFF)
|
option(SPDLOG_CLOCK_COARSE "Use CLOCK_REALTIME_COARSE instead of the regular clock," OFF)
|
||||||
@ -86,10 +85,6 @@ endif()
|
|||||||
|
|
||||||
option(SPDLOG_PREVENT_CHILD_FD "Prevent from child processes to inherit log file descriptors" OFF)
|
option(SPDLOG_PREVENT_CHILD_FD "Prevent from child processes to inherit log file descriptors" OFF)
|
||||||
option(SPDLOG_NO_THREAD_ID "prevent spdlog from querying the thread id on each log call if thread id is not needed" OFF)
|
option(SPDLOG_NO_THREAD_ID "prevent spdlog from querying the thread id on each log call if thread id is not needed" OFF)
|
||||||
option(
|
|
||||||
SPDLOG_NO_ATOMIC_LEVELS
|
|
||||||
"prevent spdlog from using of std::atomic log levels (use only if your code never modifies log levels concurrently"
|
|
||||||
OFF)
|
|
||||||
option(SPDLOG_DISABLE_DEFAULT_LOGGER "Disable default logger creation" OFF)
|
option(SPDLOG_DISABLE_DEFAULT_LOGGER "Disable default logger creation" OFF)
|
||||||
|
|
||||||
# clang-tidy
|
# clang-tidy
|
||||||
@ -245,14 +240,6 @@ if(HAVE_FWRITE_UNLOCKED)
|
|||||||
set(SPDLOG_FWRITE_UNLOCKED 1)
|
set(SPDLOG_FWRITE_UNLOCKED 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------------------
|
|
||||||
# Generate spdlog_config.h based on the current configuration
|
|
||||||
# ---------------------------------------------------------------------------------------
|
|
||||||
set(OUT_CONFIG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/spdlog/spdlog_config.h")
|
|
||||||
message(STATUS "Generating ${OUT_CONFIG_FILE}")
|
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/spdlog_config.h.in" ${OUT_CONFIG_FILE} @ONLY)
|
|
||||||
list(APPEND SPDLOG_HEADERS ${OUT_CONFIG_FILE})
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
# spdlog library
|
# spdlog library
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
@ -307,17 +294,20 @@ if(ANDROID)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
# If exceptions are disabled, disable them in the bundled fmt as well
|
# spdlog private defines according to the options
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
if(SPDLOG_NO_EXCEPTIONS)
|
foreach(
|
||||||
# Add compile definition for the fmt target
|
SPDLOG_OPTION
|
||||||
target_compile_definitions(fmt PUBLIC FMT_EXCEPTIONS=0)
|
SPDLOG_CLOCK_COARSE
|
||||||
if(NOT MSVC)
|
SPDLOG_PREVENT_CHILD_FD
|
||||||
target_compile_options(spdlog PRIVATE -fno-exceptions)
|
SPDLOG_NO_THREAD_ID
|
||||||
else()
|
SPDLOG_DISABLE_DEFAULT_LOGGER
|
||||||
target_compile_options(spdlog PRIVATE /EHs-c-)
|
SPDLOG_FWRITE_UNLOCKED)
|
||||||
|
if(${SPDLOG_OPTION})
|
||||||
|
target_compile_definitions(spdlog PRIVATE ${SPDLOG_OPTION})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endforeach()
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
# Build binaries
|
# Build binaries
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
@ -394,8 +384,4 @@ if(SPDLOG_INSTALL)
|
|||||||
# Support creation of installable packages
|
# Support creation of installable packages
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
include(cmake/spdlogCPack.cmake)
|
include(cmake/spdlogCPack.cmake)
|
||||||
|
|
||||||
# Install spdlog_config.h file Assume your tweakme.h.in is located in the same directory as CMakeLists.txt
|
|
||||||
set(TWEAKME_IN "${CMAKE_CURRENT_SOURCE_DIR}/tweakme.h.in")
|
|
||||||
set(TWEAKME_OUT "${CMAKE_CURRENT_BINARY_DIR}/include/spdlog/tweakme.h")
|
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
|
|
||||||
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
|
||||||
|
|
||||||
// DO NOT EDIT
|
|
||||||
// Auto generated file with compile time flags with which spdlog was compiled
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
// No exceptions. Will do std::abort() instead
|
|
||||||
#cmakedefine SPDLOG_NO_EXCEPTIONS
|
|
||||||
|
|
||||||
// Use CLOCK_REALTIME_COARSE on Linux
|
|
||||||
#cmakedefine SPDLOG_CLOCK_COARSE
|
|
||||||
|
|
||||||
// Prevent child processes from inheriting log file descriptors
|
|
||||||
#cmakedefine SPDLOG_PREVENT_CHILD_FD
|
|
||||||
|
|
||||||
// Prevent spdlog from querying the thread id on each log call
|
|
||||||
#cmakedefine SPDLOG_NO_THREAD_ID
|
|
||||||
|
|
||||||
// Prevent spdlog from using std::atomic for log levels
|
|
||||||
#cmakedefine SPDLOG_NO_ATOMIC_LEVELS
|
|
||||||
|
|
||||||
// Disable default logger creation
|
|
||||||
#cmakedefine SPDLOG_DISABLE_DEFAULT_LOGGER
|
|
||||||
|
|
||||||
// Use external fmtlib instead of bundled
|
|
||||||
#cmakedefine SPDLOG_FMT_EXTERNAL
|
|
||||||
|
|
||||||
// Whether fwrite_unlocked is available
|
|
||||||
#cmakedefine SPDLOG_FWRITE_UNLOCKED
|
|
@ -15,7 +15,7 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#include "./source_loc.h"
|
#include "./source_loc.h"
|
||||||
#include "./spdlog_config.h"
|
|
||||||
|
|
||||||
#if defined(SPDLOG_SHARED_LIB)
|
#if defined(SPDLOG_SHARED_LIB)
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@ -40,22 +40,6 @@
|
|||||||
#define SPDLOG_FUNCTION static_cast<const char *>(__FUNCTION__)
|
#define SPDLOG_FUNCTION static_cast<const char *>(__FUNCTION__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SPDLOG_NO_EXCEPTIONS
|
|
||||||
#define SPDLOG_TRY
|
|
||||||
#define SPDLOG_THROW(ex) \
|
|
||||||
do { \
|
|
||||||
printf("spdlog fatal error: %s\n", ex.what()); \
|
|
||||||
std::abort(); \
|
|
||||||
} while (0)
|
|
||||||
#define SPDLOG_CATCH_STD
|
|
||||||
#else
|
|
||||||
#define SPDLOG_TRY try
|
|
||||||
#define SPDLOG_THROW(ex) throw(ex)
|
|
||||||
#define SPDLOG_CATCH_STD \
|
|
||||||
catch (const std::exception &) { \
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
|
|
||||||
class formatter;
|
class formatter;
|
||||||
@ -106,11 +90,7 @@ enum class level {
|
|||||||
n_levels
|
n_levels
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(SPDLOG_NO_ATOMIC_LEVELS)
|
|
||||||
using atomic_level_t = details::null_atomic<level>;
|
|
||||||
#else
|
|
||||||
using atomic_level_t = std::atomic<level>;
|
using atomic_level_t = std::atomic<level>;
|
||||||
#endif
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr size_t level_to_number(level lvl) noexcept { return static_cast<size_t>(lvl); }
|
[[nodiscard]] constexpr size_t level_to_number(level lvl) noexcept { return static_cast<size_t>(lvl); }
|
||||||
|
|
||||||
|
@ -5,5 +5,4 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../spdlog_config.h"
|
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
|
@ -22,22 +22,20 @@
|
|||||||
#include "./details/log_msg.h"
|
#include "./details/log_msg.h"
|
||||||
#include "./sinks/sink.h"
|
#include "./sinks/sink.h"
|
||||||
|
|
||||||
#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.empty()) { \
|
if (!location.empty()) { \
|
||||||
err_handler_(fmt_lib::format(SPDLOG_FMT_STRING("{} [{}({})]"), ex.what(), location.filename, location.line)); \
|
err_handler_(fmt_lib::format(SPDLOG_FMT_STRING("{} [{}({})]"), ex.what(), location.filename, location.line)); \
|
||||||
} else { \
|
} else { \
|
||||||
err_handler_(ex.what()); \
|
err_handler_(ex.what()); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
catch (...) { \
|
catch (...) { \
|
||||||
err_handler_("Rethrowing unknown exception in logger"); \
|
err_handler_("Rethrowing unknown exception in logger"); \
|
||||||
throw; \
|
throw; \
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#define SPDLOG_LOGGER_CATCH(location)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
|
|
||||||
@ -186,7 +184,7 @@ protected:
|
|||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void log_with_format_(source_loc loc, const level lvl, const format_string_t<Args...> &format_string, Args &&...args) {
|
void log_with_format_(source_loc loc, const level lvl, const format_string_t<Args...> &format_string, Args &&...args) {
|
||||||
assert(should_log(lvl));
|
assert(should_log(lvl));
|
||||||
SPDLOG_TRY {
|
try {
|
||||||
memory_buf_t buf;
|
memory_buf_t buf;
|
||||||
fmt::vformat_to(std::back_inserter(buf), format_string, fmt::make_format_args(args...));
|
fmt::vformat_to(std::back_inserter(buf), format_string, fmt::make_format_args(args...));
|
||||||
sink_it_(details::log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size())));
|
sink_it_(details::log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size())));
|
||||||
@ -199,7 +197,7 @@ protected:
|
|||||||
assert(should_log(msg.log_level));
|
assert(should_log(msg.log_level));
|
||||||
for (auto &sink : sinks_) {
|
for (auto &sink : sinks_) {
|
||||||
if (sink->should_log(msg.log_level)) {
|
if (sink->should_log(msg.log_level)) {
|
||||||
SPDLOG_TRY { sink->log(msg); }
|
try { sink->log(msg); }
|
||||||
SPDLOG_LOGGER_CATCH(msg.source)
|
SPDLOG_LOGGER_CATCH(msg.source)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ private:
|
|||||||
bool ok = remove_if_exists(old_filename) == 0;
|
bool ok = remove_if_exists(old_filename) == 0;
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
filenames_q_.push_back(std::move(current_file));
|
filenames_q_.push_back(std::move(current_file));
|
||||||
SPDLOG_THROW(spdlog_ex("Failed removing hourly file " + filename_to_str(old_filename), errno));
|
throw(spdlog_ex("Failed removing hourly file " + filename_to_str(old_filename), errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filenames_q_.push_back(std::move(current_file));
|
filenames_q_.push_back(std::move(current_file));
|
||||||
|
@ -69,17 +69,13 @@ protected:
|
|||||||
// Note: function call inside '()' to avoid macro expansion
|
// Note: function call inside '()' to avoid macro expansion
|
||||||
err = (sd_journal_send)("MESSAGE=%.*s", static_cast<int>(length), payload.data(), "PRIORITY=%d",
|
err = (sd_journal_send)("MESSAGE=%.*s", static_cast<int>(length), payload.data(), "PRIORITY=%d",
|
||||||
syslog_level(msg.log_level),
|
syslog_level(msg.log_level),
|
||||||
#ifndef SPDLOG_NO_THREAD_ID
|
|
||||||
"TID=%zu", msg.thread_id,
|
"TID=%zu", msg.thread_id,
|
||||||
#endif
|
|
||||||
"SYSLOG_IDENTIFIER=%.*s", static_cast<int>(syslog_identifier.size()),
|
"SYSLOG_IDENTIFIER=%.*s", static_cast<int>(syslog_identifier.size()),
|
||||||
syslog_identifier.data(), nullptr);
|
syslog_identifier.data(), nullptr);
|
||||||
} else {
|
} else {
|
||||||
err = (sd_journal_send)("MESSAGE=%.*s", static_cast<int>(length), payload.data(), "PRIORITY=%d",
|
err = (sd_journal_send)("MESSAGE=%.*s", static_cast<int>(length), payload.data(), "PRIORITY=%d",
|
||||||
syslog_level(msg.log_level),
|
syslog_level(msg.log_level),
|
||||||
#ifndef SPDLOG_NO_THREAD_ID
|
|
||||||
"TID=%zu", msg.thread_id,
|
"TID=%zu", msg.thread_id,
|
||||||
#endif
|
|
||||||
"SYSLOG_IDENTIFIER=%.*s", static_cast<int>(syslog_identifier.size()),
|
"SYSLOG_IDENTIFIER=%.*s", static_cast<int>(syslog_identifier.size()),
|
||||||
syslog_identifier.data(), "CODE_FILE=%s", msg.source.filename, "CODE_LINE=%d",
|
syslog_identifier.data(), "CODE_FILE=%s", msg.source.filename, "CODE_LINE=%d",
|
||||||
msg.source.line, "CODE_FUNC=%s", msg.source.funcname, nullptr);
|
msg.source.line, "CODE_FUNC=%s", msg.source.funcname, nullptr);
|
||||||
|
@ -23,7 +23,7 @@ spdlog::async_logger::async_logger(std::string logger_name,
|
|||||||
|
|
||||||
// send the log message to the thread pool
|
// send the log message to the thread pool
|
||||||
void spdlog::async_logger::sink_it_(const details::log_msg &msg) {
|
void spdlog::async_logger::sink_it_(const details::log_msg &msg) {
|
||||||
SPDLOG_TRY {
|
try {
|
||||||
if (auto pool_ptr = thread_pool_.lock()) {
|
if (auto pool_ptr = thread_pool_.lock()) {
|
||||||
pool_ptr->post_log(shared_from_this(), msg, overflow_policy_);
|
pool_ptr->post_log(shared_from_this(), msg, overflow_policy_);
|
||||||
} else {
|
} else {
|
||||||
@ -35,7 +35,7 @@ void spdlog::async_logger::sink_it_(const details::log_msg &msg) {
|
|||||||
|
|
||||||
// send flush request to the thread pool
|
// send flush request to the thread pool
|
||||||
void spdlog::async_logger::flush_() {
|
void spdlog::async_logger::flush_() {
|
||||||
SPDLOG_TRY {
|
try {
|
||||||
if (auto pool_ptr = thread_pool_.lock()) {
|
if (auto pool_ptr = thread_pool_.lock()) {
|
||||||
pool_ptr->post_flush(shared_from_this(), overflow_policy_);
|
pool_ptr->post_flush(shared_from_this(), overflow_policy_);
|
||||||
} else {
|
} else {
|
||||||
@ -51,7 +51,7 @@ void spdlog::async_logger::flush_() {
|
|||||||
void spdlog::async_logger::backend_sink_it_(const details::log_msg &msg) {
|
void spdlog::async_logger::backend_sink_it_(const details::log_msg &msg) {
|
||||||
for (auto &sink : sinks_) {
|
for (auto &sink : sinks_) {
|
||||||
if (sink->should_log(msg.log_level)) {
|
if (sink->should_log(msg.log_level)) {
|
||||||
SPDLOG_TRY { sink->log(msg); }
|
try { sink->log(msg); }
|
||||||
SPDLOG_LOGGER_CATCH(msg.source)
|
SPDLOG_LOGGER_CATCH(msg.source)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ void spdlog::async_logger::backend_sink_it_(const details::log_msg &msg) {
|
|||||||
|
|
||||||
void spdlog::async_logger::backend_flush_() {
|
void spdlog::async_logger::backend_flush_() {
|
||||||
for (auto &sink : sinks_) {
|
for (auto &sink : sinks_) {
|
||||||
SPDLOG_TRY { sink->flush(); }
|
try { sink->flush(); }
|
||||||
SPDLOG_LOGGER_CATCH(source_loc())
|
SPDLOG_LOGGER_CATCH(source_loc())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@ spdlog_ex::spdlog_ex(const std::string &msg, int last_errno) {
|
|||||||
|
|
||||||
const char *spdlog_ex::what() const noexcept { return msg_.c_str(); }
|
const char *spdlog_ex::what() const noexcept { return msg_.c_str(); }
|
||||||
|
|
||||||
void throw_spdlog_ex(const std::string &msg, int last_errno) { SPDLOG_THROW(spdlog_ex(msg, last_errno)); }
|
void throw_spdlog_ex(const std::string &msg, int last_errno) { throw(spdlog_ex(msg, last_errno)); }
|
||||||
|
|
||||||
void throw_spdlog_ex(std::string msg) { SPDLOG_THROW(spdlog_ex(std::move(msg))); }
|
void throw_spdlog_ex(std::string msg) { throw(spdlog_ex(std::move(msg))); }
|
||||||
|
|
||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
@ -15,12 +15,13 @@ log_msg::log_msg(spdlog::log_clock::time_point log_time,
|
|||||||
spdlog::string_view_t msg)
|
spdlog::string_view_t msg)
|
||||||
: logger_name(a_logger_name),
|
: logger_name(a_logger_name),
|
||||||
log_level(lvl),
|
log_level(lvl),
|
||||||
time(log_time)
|
time(log_time),
|
||||||
#ifndef SPDLOG_NO_THREAD_ID
|
|
||||||
,
|
#ifdef SPDLOG_NO_THREAD_ID
|
||||||
thread_id(os::thread_id())
|
thread_id(0),
|
||||||
|
#else
|
||||||
|
thread_id(os::thread_id()),
|
||||||
#endif
|
#endif
|
||||||
,
|
|
||||||
source(loc),
|
source(loc),
|
||||||
payload(msg) {
|
payload(msg) {
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ thread_pool::thread_pool(size_t q_max_items, size_t threads_n)
|
|||||||
|
|
||||||
// message all threads to terminate gracefully join them
|
// message all threads to terminate gracefully join them
|
||||||
thread_pool::~thread_pool() {
|
thread_pool::~thread_pool() {
|
||||||
SPDLOG_TRY {
|
try {
|
||||||
for (size_t i = 0; i < threads_.size(); i++) {
|
for (size_t i = 0; i < threads_.size(); i++) {
|
||||||
post_async_msg_(async_msg(async_msg_type::terminate), async_overflow_policy::block);
|
post_async_msg_(async_msg(async_msg_type::terminate), async_overflow_policy::block);
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ thread_pool::~thread_pool() {
|
|||||||
t.join();
|
t.join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SPDLOG_CATCH_STD
|
catch (...) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
void thread_pool::post_log(async_logger_ptr &&worker_ptr, const details::log_msg &msg, async_overflow_policy overflow_policy) {
|
void thread_pool::post_log(async_logger_ptr &&worker_ptr, const details::log_msg &msg, async_overflow_policy overflow_policy) {
|
||||||
|
@ -75,7 +75,7 @@ std::shared_ptr<logger> logger::clone(std::string logger_name) {
|
|||||||
// private/protected methods
|
// private/protected methods
|
||||||
void logger::flush_() {
|
void logger::flush_() {
|
||||||
for (auto &sink : sinks_) {
|
for (auto &sink : sinks_) {
|
||||||
SPDLOG_TRY { sink->flush(); }
|
try { sink->flush(); }
|
||||||
SPDLOG_LOGGER_CATCH(source_loc())
|
SPDLOG_LOGGER_CATCH(source_loc())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,16 +53,13 @@ set(SPDLOG_UTESTS_SOURCES
|
|||||||
test_no_source_location.cpp
|
test_no_source_location.cpp
|
||||||
test_log_level.cpp
|
test_log_level.cpp
|
||||||
test_include_sinks.cpp
|
test_include_sinks.cpp
|
||||||
test_bin_to_hex.cpp)
|
test_bin_to_hex.cpp
|
||||||
|
test_errors.cpp)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
list(APPEND SPDLOG_UTESTS_SOURCES test_eventlog.cpp)
|
list(APPEND SPDLOG_UTESTS_SOURCES test_eventlog.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT SPDLOG_NO_EXCEPTIONS)
|
|
||||||
list(APPEND SPDLOG_UTESTS_SOURCES test_errors.cpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(systemd_FOUND)
|
if(systemd_FOUND)
|
||||||
list(APPEND SPDLOG_UTESTS_SOURCES test_systemd.cpp)
|
list(APPEND SPDLOG_UTESTS_SOURCES test_systemd.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
static const char *const tested_logger_name = "null_logger";
|
static const char *const tested_logger_name = "null_logger";
|
||||||
static const char *const tested_logger_name2 = "null_logger2";
|
static const char *const tested_logger_name2 = "null_logger2";
|
||||||
|
|
||||||
#ifndef SPDLOG_NO_EXCEPTIONS
|
|
||||||
TEST_CASE("register_drop", "[registry]") {
|
TEST_CASE("register_drop", "[registry]") {
|
||||||
spdlog::drop_all();
|
spdlog::drop_all();
|
||||||
spdlog::create<spdlog::sinks::null_sink_mt>(tested_logger_name);
|
spdlog::create<spdlog::sinks::null_sink_mt>(tested_logger_name);
|
||||||
@ -24,7 +23,6 @@ TEST_CASE("explicit register", "[registry]") {
|
|||||||
// Throw if registering existing name
|
// Throw if registering existing name
|
||||||
REQUIRE_THROWS_AS(spdlog::create<spdlog::sinks::null_sink_mt>(tested_logger_name), spdlog::spdlog_ex);
|
REQUIRE_THROWS_AS(spdlog::create<spdlog::sinks::null_sink_mt>(tested_logger_name), spdlog::spdlog_ex);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
TEST_CASE("apply_all", "[registry]") {
|
TEST_CASE("apply_all", "[registry]") {
|
||||||
spdlog::drop_all();
|
spdlog::drop_all();
|
||||||
|
Loading…
Reference in New Issue
Block a user