Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gabime/spdlog.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-format6
-rw-r--r--CMakeLists.txt2
-rw-r--r--example/example.cpp13
-rw-r--r--include/spdlog/async_logger-inl.h9
-rw-r--r--include/spdlog/async_logger.h2
-rw-r--r--include/spdlog/common-inl.h40
-rw-r--r--include/spdlog/common.h38
-rw-r--r--include/spdlog/details/circular_q.h3
-rw-r--r--include/spdlog/details/console_globals.h1
-rw-r--r--include/spdlog/details/file_helper-inl.h1
-rw-r--r--include/spdlog/details/file_helper.h2
-rw-r--r--include/spdlog/details/log_msg-inl.h16
-rw-r--r--include/spdlog/details/log_msg.h3
-rw-r--r--include/spdlog/details/mpmc_blocking_q.h3
-rw-r--r--include/spdlog/details/null_mutex.h3
-rw-r--r--include/spdlog/details/os.h2
-rw-r--r--include/spdlog/details/pattern_formatter-inl.h54
-rw-r--r--include/spdlog/details/pattern_formatter.h11
-rw-r--r--include/spdlog/details/periodic_worker-inl.h10
-rw-r--r--include/spdlog/details/periodic_worker.h2
-rw-r--r--include/spdlog/details/registry.h2
-rw-r--r--include/spdlog/details/thread_pool-inl.h25
-rw-r--r--include/spdlog/details/thread_pool.h11
-rw-r--r--include/spdlog/fmt/bin_to_hex.h3
-rw-r--r--include/spdlog/fmt/fmt.h2
-rw-r--r--include/spdlog/logger-inl.h56
-rw-r--r--include/spdlog/logger.h11
-rw-r--r--include/spdlog/sinks/android_sink.h3
-rw-r--r--include/spdlog/sinks/ansicolor_sink.h2
-rw-r--r--include/spdlog/sinks/ostream_sink.h3
-rw-r--r--include/spdlog/sinks/sink-inl.h6
-rw-r--r--include/spdlog/sinks/sink.h2
-rw-r--r--include/spdlog/sinks/stdout_sinks.h3
-rw-r--r--src/format.cc65
-rw-r--r--src/format.cpp51
-rw-r--r--src/spdlog.cpp7
-rw-r--r--tests/test_errors.cpp3
37 files changed, 227 insertions, 249 deletions
diff --git a/.clang-format b/.clang-format
index aa95f7a5..bd1caad1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -32,9 +32,9 @@ BraceWrapping:
BeforeCatch: true
BeforeElse: true
IndentBraces: false
- SplitEmptyFunction: true
- SplitEmptyRecord: true
- SplitEmptyNamespace: true
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 775e236f..4b2775b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,7 +60,7 @@ message(STATUS "Static lib: " ${SPDLOG_STATIC_LIB})
if(SPDLOG_STATIC_LIB)
add_definitions(-DSPDLOG_STATIC_LIB)
set(SRC_BASE "${CMAKE_CURRENT_SOURCE_DIR}/src")
- set(SRC_FILES "${SRC_BASE}/spdlog.cpp" "${SRC_BASE}/format.cc")
+ set(SRC_FILES "${SRC_BASE}/spdlog.cpp" "${SRC_BASE}/format.cpp")
add_library(spdlog STATIC ${SRC_FILES})
target_include_directories(spdlog PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>")
target_link_libraries(spdlog -Wl,--as-needed)
diff --git a/example/example.cpp b/example/example.cpp
index 519e1a7e..532bbb5c 100644
--- a/example/example.cpp
+++ b/example/example.cpp
@@ -7,10 +7,15 @@
//
//
-#include "spdlog/spdlog.h"
-
+//#include "spdlog/spdlog.h"
+#include "spdlog/logger.h"
+//#include "spdlog/sinks/stdout_color_sinks.h"
int main(int, char *[])
{
- int i = 123;
- spdlog::info("HELLO STATIC! {}", i);
+ spdlog::logger *l = nullptr;
+ const int i = 123;
+ l->info("HELLO STATIC! {}", i);
+ l->info("HELLO STATIC! {}", "GABI");
+ l->info("HELLO STATIC! {} {}", "GABI", i);
+ l->warn("HELLO STATIC! {} {}", "GABI", i);
} \ No newline at end of file
diff --git a/include/spdlog/async_logger-inl.h b/include/spdlog/async_logger-inl.h
index 84b5cd71..027366c8 100644
--- a/include/spdlog/async_logger-inl.h
+++ b/include/spdlog/async_logger-inl.h
@@ -16,20 +16,17 @@ SPDLOG_INLINE spdlog::async_logger::async_logger(
: logger(std::move(logger_name), begin, end)
, thread_pool_(std::move(tp))
, overflow_policy_(overflow_policy)
-{
-}
+{}
SPDLOG_INLINE spdlog::async_logger::async_logger(
std::string logger_name, sinks_init_list sinks_list, std::weak_ptr<details::thread_pool> tp, async_overflow_policy overflow_policy)
: async_logger(std::move(logger_name), sinks_list.begin(), sinks_list.end(), std::move(tp), overflow_policy)
-{
-}
+{}
SPDLOG_INLINE spdlog::async_logger::async_logger(
std::string logger_name, sink_ptr single_sink, std::weak_ptr<details::thread_pool> tp, async_overflow_policy overflow_policy)
: async_logger(std::move(logger_name), {std::move(single_sink)}, std::move(tp), overflow_policy)
-{
-}
+{}
// send the log message to the thread pool
SPDLOG_INLINE void spdlog::async_logger::sink_it_(details::log_msg &msg)
diff --git a/include/spdlog/async_logger.h b/include/spdlog/async_logger.h
index 907cf720..9651da4d 100644
--- a/include/spdlog/async_logger.h
+++ b/include/spdlog/async_logger.h
@@ -60,6 +60,6 @@ private:
};
} // namespace spdlog
-#ifndef SPDLOG_STATIC_LIB
+#ifdef SPDLOG_HEADER_ONLY
#include "async_logger-inl.h"
#endif
diff --git a/include/spdlog/common-inl.h b/include/spdlog/common-inl.h
index 40e746f2..dd619a57 100644
--- a/include/spdlog/common-inl.h
+++ b/include/spdlog/common-inl.h
@@ -1,23 +1,53 @@
// Copyright(c) 2015-present Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
-#pragma once
+#pragma once
+namespace spdlog {
+namespace level {
+static string_view_t level_string_views[] SPDLOG_LEVEL_NAMES;
-SPDLOG_INLINE spdlog::spdlog_ex::spdlog_ex(std::string msg)
-: msg_(std::move(msg))
+static const char *short_level_names[] SPDLOG_SHORT_LEVEL_NAMES;
+
+SPDLOG_INLINE string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
+{
+ return level_string_views[l];
+}
+
+SPDLOG_INLINE const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
{
+ return short_level_names[l];
}
-SPDLOG_INLINE spdlog::spdlog_ex::spdlog_ex(const std::string &msg, int last_errno)
+SPDLOG_INLINE spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT
+{
+ int level = 0;
+ for (const auto &level_str : level_string_views)
+ {
+ if (level_str == name)
+ {
+ return static_cast<level::level_enum>(level);
+ }
+ level++;
+ }
+ return level::off;
+}
+} // namespace level
+
+SPDLOG_INLINE spdlog_ex::spdlog_ex(std::string msg)
+ : msg_(std::move(msg))
+{}
+
+SPDLOG_INLINE spdlog_ex::spdlog_ex(const std::string &msg, int last_errno)
{
fmt::memory_buffer outbuf;
fmt::format_system_error(outbuf, last_errno, msg);
msg_ = fmt::to_string(outbuf);
}
-SPDLOG_INLINE const char *spdlog::spdlog_ex::what() const SPDLOG_NOEXCEPT
+SPDLOG_INLINE const char *spdlog_ex::what() const SPDLOG_NOEXCEPT
{
return msg_.c_str();
}
+} // namespace spdlog
diff --git a/include/spdlog/common.h b/include/spdlog/common.h
index 64eff8d1..f37f08fe 100644
--- a/include/spdlog/common.h
+++ b/include/spdlog/common.h
@@ -22,8 +22,10 @@
#include "spdlog/fmt/fmt.h"
#ifdef SPDLOG_STATIC_LIB
+#undef SPDLOG_HEADER_ONLY
#define SPDLOG_INLINE
#else
+#define SPDLOG_HEADER_ONLY
#define SPDLOG_INLINE inline
#endif
@@ -138,39 +140,18 @@ enum level_enum
"trace", "debug", "info", "warning", "error", "critical", "off" \
}
#endif
-static string_view_t level_string_views[] SPDLOG_LEVEL_NAMES;
#if !defined(SPDLOG_SHORT_LEVEL_NAMES)
+
#define SPDLOG_SHORT_LEVEL_NAMES \
{ \
"T", "D", "I", "W", "E", "C", "O" \
}
#endif
-static const char *short_level_names[] SPDLOG_SHORT_LEVEL_NAMES;
-inline string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
-{
- return level_string_views[l];
-}
-
-inline const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
-{
- return short_level_names[l];
-}
-
-inline spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT
-{
- int level = 0;
- for (const auto &level_str : level_string_views)
- {
- if (level_str == name)
- {
- return static_cast<level::level_enum>(level);
- }
- level++;
- }
- return level::off;
-}
+string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
+const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
+spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT;
using level_hasher = std::hash<int>;
} // namespace level
@@ -206,8 +187,7 @@ struct source_loc
: filename{filename_in}
, line{line_in}
, funcname{funcname_in}
- {
- }
+ {}
SPDLOG_CONSTEXPR bool empty() const SPDLOG_NOEXCEPT
{
@@ -234,6 +214,6 @@ std::unique_ptr<T> make_unique(Args &&... args)
} // namespace details
} // namespace spdlog
-#ifndef SPDLOG_STATIC_LIB
-#include "commont-inl.h"
+#ifdef SPDLOG_HEADER_ONLY
+#include "common-inl.h"
#endif \ No newline at end of file
diff --git a/include/spdlog/details/circular_q.h b/include/spdlog/details/circular_q.h
index 4bf5ca13..b6324e06 100644
--- a/include/spdlog/details/circular_q.h
+++ b/include/spdlog/details/circular_q.h
@@ -17,8 +17,7 @@ public:
explicit circular_q(size_t max_items)
: max_items_(max_items + 1) // one item is reserved as marker for full q
, v_(max_items_)
- {
- }
+ {}
// push back, overrun (oldest) item if no room left
void push_back(T &&item)
diff --git a/include/spdlog/details/console_globals.h b/include/spdlog/details/console_globals.h
index 443f8657..85ff9023 100644
--- a/include/spdlog/details/console_globals.h
+++ b/include/spdlog/details/console_globals.h
@@ -3,7 +3,6 @@
#pragma once
-
#include "spdlog/details/null_mutex.h"
#include <cstdio>
#include <mutex>
diff --git a/include/spdlog/details/file_helper-inl.h b/include/spdlog/details/file_helper-inl.h
index 3e709654..fef3be01 100644
--- a/include/spdlog/details/file_helper-inl.h
+++ b/include/spdlog/details/file_helper-inl.h
@@ -14,6 +14,7 @@
namespace spdlog {
namespace details {
+
SPDLOG_INLINE file_helper::~file_helper()
{
close();
diff --git a/include/spdlog/details/file_helper.h b/include/spdlog/details/file_helper.h
index 87a0076a..afacc4c6 100644
--- a/include/spdlog/details/file_helper.h
+++ b/include/spdlog/details/file_helper.h
@@ -55,6 +55,6 @@ private:
} // namespace details
} // namespace spdlog
-#ifndef SPDLOG_STATIC_LIB
+#ifdef SPDLOG_HEADER_ONLY
#include "file_helper-inl.h"
#endif
diff --git a/include/spdlog/details/log_msg-inl.h b/include/spdlog/details/log_msg-inl.h
index d8ca61a4..b619f7ce 100644
--- a/include/spdlog/details/log_msg-inl.h
+++ b/include/spdlog/details/log_msg-inl.h
@@ -6,7 +6,10 @@
#include "spdlog/details/os.h"
#include "spdlog/sinks/sink.h"
-SPDLOG_INLINE spdlog::details::log_msg::log_msg(
+namespace spdlog {
+namespace details {
+
+SPDLOG_INLINE log_msg::log_msg(
spdlog::source_loc loc, const std::string *loggers_name, spdlog::level::level_enum lvl, spdlog::string_view_t view)
: logger_name(loggers_name)
, level(lvl)
@@ -19,10 +22,11 @@ SPDLOG_INLINE spdlog::details::log_msg::log_msg(
#endif
, source(loc)
, payload(view)
-{
-}
+{}
-SPDLOG_INLINE spdlog::details::log_msg::log_msg(const std::string *loggers_name, spdlog::level::level_enum lvl, spdlog::string_view_t view)
+SPDLOG_INLINE log_msg::log_msg(const std::string *loggers_name, spdlog::level::level_enum lvl, spdlog::string_view_t view)
: log_msg(source_loc{}, loggers_name, lvl, view)
-{
-} \ No newline at end of file
+{}
+
+} // namespace details
+} // namespace spdlog
diff --git a/include/spdlog/details/log_msg.h b/include/spdlog/details/log_msg.h
index 9d3cbab4..152d27ad 100644
--- a/include/spdlog/details/log_msg.h
+++ b/include/spdlog/details/log_msg.h
@@ -11,7 +11,6 @@ namespace details {
struct log_msg
{
log_msg(source_loc loc, const std::string *loggers_name, level::level_enum lvl, string_view_t view);
-
log_msg(const std::string *loggers_name, level::level_enum lvl, string_view_t view);
log_msg(const log_msg &other) = default;
@@ -31,6 +30,6 @@ struct log_msg
} // namespace details
} // namespace spdlog
-#ifndef SPDLOG_STATIC_LIB
+#ifdef SPDLOG_HEADER_ONLY
#include "log_msg-inl.h"
#endif
diff --git a/include/spdlog/details/mpmc_blocking_q.h b/include/spdlog/details/mpmc_blocking_q.h
index 3a383bfe..4d162d83 100644
--- a/include/spdlog/details/mpmc_blocking_q.h
+++ b/include/spdlog/details/mpmc_blocking_q.h
@@ -25,8 +25,7 @@ public:
using item_type = T;
explicit mpmc_blocking_queue(size_t max_items)
: q_(max_items)
- {
- }
+ {}
#ifndef __MINGW32__
// try to enqueue and block if no room left
diff --git a/include/spdlog/details/null_mutex.h b/include/spdlog/details/null_mutex.h
index 2dc1f98b..aa54f79a 100644
--- a/include/spdlog/details/null_mutex.h
+++ b/include/spdlog/details/null_mutex.h
@@ -25,8 +25,7 @@ struct null_atomic_int
explicit null_atomic_int(int val)
: value(val)
- {
- }
+ {}
int load(std::memory_order) const
{
diff --git a/include/spdlog/details/os.h b/include/spdlog/details/os.h
index dc4ce16b..3197ec69 100644
--- a/include/spdlog/details/os.h
+++ b/include/spdlog/details/os.h
@@ -88,6 +88,6 @@ void wbuf_to_utf8buf(const fmt::wmemory_buffer &wbuf, fmt::memory_buffer &target
} // namespace details
} // namespace spdlog
-#ifndef SPDLOG_STATIC_LIB
+#ifdef SPDLOG_HEADER_ONLY
#include "os-inl.h"
#endif
diff --git a/include/spdlog/details/pattern_formatter-inl.h b/include/spdlog/details/pattern_formatter-inl.h
index efb5f1e6..9275d8ef 100644
--- a/include/spdlog/details/pattern_formatter-inl.h
+++ b/include/spdlog/details/pattern_formatter-inl.h
@@ -58,8 +58,7 @@ public:
scoped_pad(spdlog::string_view_t txt, padding_info &padinfo, fmt::memory_buffer &dest)
: scoped_pad(txt.size(), padinfo, dest)
- {
- }
+ {}
~scoped_pad()
{
@@ -90,8 +89,7 @@ class name_formatter : public flag_formatter
public:
explicit name_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
{
@@ -113,8 +111,7 @@ class level_formatter : public flag_formatter
public:
explicit level_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
{
@@ -137,8 +134,7 @@ class short_level_formatter : public flag_formatter
public:
explicit short_level_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
{
@@ -169,8 +165,7 @@ class a_formatter : public flag_formatter
public:
explicit a_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
{
@@ -187,8 +182,7 @@ class A_formatter : public flag_formatter
public:
explicit A_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
{
@@ -205,8 +199,7 @@ class b_formatter : public flag_formatter
public:
explicit b_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
{
@@ -224,8 +217,7 @@ class B_formatter : public flag_formatter
public:
explicit B_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
{
@@ -241,8 +233,7 @@ class c_formatter final : public flag_formatter
public:
explicit c_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
{
@@ -273,8 +264,7 @@ class C_formatter final : public flag_formatter
public:
explicit C_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
{
@@ -290,8 +280,7 @@ class D_formatter final : public flag_formatter
public:
explicit D_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
{
@@ -327,8 +316,7 @@ class m_formatter final : public flag_formatter
public:
explicit m_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
{
@@ -344,8 +332,7 @@ class d_formatter final : public flag_formatter
public:
explicit d_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
{
@@ -361,8 +348,7 @@ class H_formatter final : public flag_formatter
public:
explicit H_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
{
@@ -707,8 +693,7 @@ class ch_formatter final : public flag_formatter
public:
explicit ch_formatter(char ch)
: ch_(ch)
- {
- }
+ {}
void format(const details::log_msg &, const std::tm &, fmt::memory_buffer &dest) override
{
@@ -746,8 +731,7 @@ class color_start_formatter final : public flag_formatter
public:
explicit color_start_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
{
@@ -759,8 +743,7 @@ class color_stop_formatter final : public flag_formatter
public:
explicit color_stop_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
{
@@ -864,8 +847,7 @@ class full_formatter final : public flag_formatter
public:
explicit full_formatter(padding_info padinfo)
: flag_formatter(padinfo)
- {
- }
+ {}
void format(const details::log_msg &msg, const std::tm &tm_time, fmt::memory_buffer &dest) override
{
diff --git a/include/spdlog/details/pattern_formatter.h b/include/spdlog/details/pattern_formatter.h
index 4b36ed06..b6052c1b 100644
--- a/include/spdlog/details/pattern_formatter.h
+++ b/include/spdlog/details/pattern_formatter.h
@@ -6,7 +6,6 @@
#include "spdlog/common.h"
#include "spdlog/details/log_msg.h"
#include "spdlog/details/os.h"
-#include "spdlog/fmt/fmt.h"
#include "spdlog/formatter.h"
#include <chrono>
@@ -33,8 +32,7 @@ struct padding_info
padding_info(size_t width, padding_info::pad_side side)
: width_(width)
, side_(side)
- {
- }
+ {}
bool enabled() const
{
@@ -49,8 +47,7 @@ class flag_formatter
public:
explicit flag_formatter(padding_info padinfo)
: padinfo_(padinfo)
- {
- }
+ {}
flag_formatter() = default;
virtual ~flag_formatter() = default;
virtual void format(const details::log_msg &msg, const std::tm &tm_time, fmt::memory_buffer &dest) = 0;
@@ -83,8 +80,8 @@ private:
std::tm cached_tm_;
std::chrono::seconds last_log_secs_;
std::vector<std::unique_ptr<details::flag_formatter>> formatters_;
- std::tm get_time_(const details::log_msg &msg);
+ std::tm get_time_(const details::log_msg &msg);
void handle_flag_(char flag, details::padding_info padding);
// Extract given pad spec (e.g. %8X)
@@ -96,6 +93,6 @@ private:
};
} // namespace spdlog
-#ifndef SPDLOG_STATIC_LIB
+#ifdef SPDLOG_HEADER_ONLY
#include "pattern_formatter-inl.h"
#endif
diff --git a/include/spdlog/details/periodic_worker-inl.h b/include/spdlog/details/periodic_worker-inl.h
index dc363913..cfc9af72 100644
--- a/include/spdlog/details/periodic_worker-inl.h
+++ b/include/spdlog/details/periodic_worker-inl.h
@@ -2,8 +2,9 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
-
-SPDLOG_INLINE spdlog::details::periodic_worker::periodic_worker(const std::function<void()> &callback_fun, std::chrono::seconds interval)
+namespace spdlog {
+namespace details {
+SPDLOG_INLINE periodic_worker::periodic_worker(const std::function<void()> &callback_fun, std::chrono::seconds interval)
{
active_ = (interval > std::chrono::seconds::zero());
if (!active_)
@@ -25,7 +26,7 @@ SPDLOG_INLINE spdlog::details::periodic_worker::periodic_worker(const std::funct
}
// stop the worker thread and join it
-SPDLOG_INLINE spdlog::details::periodic_worker::~periodic_worker()
+SPDLOG_INLINE periodic_worker::~periodic_worker()
{
if (worker_thread_.joinable())
{
@@ -37,3 +38,6 @@ SPDLOG_INLINE spdlog::details::periodic_worker::~periodic_worker()
worker_thread_.join();
}
}
+
+} // namespace details
+} // namespace spdlog
diff --git a/include/spdlog/details/periodic_worker.h b/include/spdlog/details/periodic_worker.h
index da8ca8bb..24b9b96c 100644
--- a/include/spdlog/details/periodic_worker.h
+++ b/include/spdlog/details/periodic_worker.h
@@ -35,6 +35,6 @@ private:
} // namespace details
} // namespace spdlog
-#ifndef SPDLOG_STATIC_LIB
+#ifdef SPDLOG_HEADER_ONLY
#include "periodic_worker-inl.h"
#endif
diff --git a/include/spdlog/details/registry.h b/include/spdlog/details/registry.h
index 267d30a2..bc6b2cc2 100644
--- a/include/spdlog/details/registry.h
+++ b/include/spdlog/details/registry.h
@@ -99,6 +99,6 @@ private:
} // namespace details
} // namespace spdlog
-#ifndef SPDLOG_STATIC_LIB
+#ifdef SPDLOG_HEADER_ONLY
#include "registry-inl.h"
#endif
diff --git a/include/spdlog/details/thread_pool-inl.h b/include/spdlog/details/thread_pool-inl.h
index d9618215..a7b77437 100644
--- a/include/spdlog/details/thread_pool-inl.h
+++ b/include/spdlog/details/thread_pool-inl.h
@@ -5,7 +5,9 @@
#include "spdlog/common.h"
-SPDLOG_INLINE spdlog::details::thread_pool::thread_pool(size_t q_max_items, size_t threads_n)
+namespace spdlog {
+namespace details {
+SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, size_t threads_n)
: q_(q_max_items)
{
if (threads_n == 0 || threads_n > 1000)
@@ -20,7 +22,7 @@ SPDLOG_INLINE spdlog::details::thread_pool::thread_pool(size_t q_max_items, size
}
// message all threads to terminate gracefully join them
-SPDLOG_INLINE spdlog::details::thread_pool::~thread_pool()
+SPDLOG_INLINE thread_pool::~thread_pool()
{
try
{
@@ -35,28 +37,26 @@ SPDLOG_INLINE spdlog::details::thread_pool::~thread_pool()
}
}
catch (...)
- {
- }
+ {}
}
-void SPDLOG_INLINE spdlog::details::thread_pool::post_log(
- async_logger_ptr &&worker_ptr, details::log_msg &msg, async_overflow_policy overflow_policy)
+void SPDLOG_INLINE thread_pool::post_log(async_logger_ptr &&worker_ptr, details::log_msg &msg, async_overflow_policy overflow_policy)
{
async_msg async_m(std::move(worker_ptr), async_msg_type::log, msg);
post_async_msg_(std::move(async_m), overflow_policy);
}
-void SPDLOG_INLINE spdlog::details::thread_pool::post_flush(async_logger_ptr &&worker_ptr, async_overflow_policy overflow_policy)
+void SPDLOG_INLINE thread_pool::post_flush(async_logger_ptr &&worker_ptr, async_overflow_policy overflow_policy)
{
post_async_msg_(async_msg(std::move(worker_ptr), async_msg_type::flush), overflow_policy);
}
-size_t SPDLOG_INLINE spdlog::details::thread_pool::overrun_counter()
+size_t SPDLOG_INLINE thread_pool::overrun_counter()
{
return q_.overrun_counter();
}
-void SPDLOG_INLINE spdlog::details::thread_pool::post_async_msg_(async_msg &&new_msg, async_overflow_policy overflow_policy)
+void SPDLOG_INLINE thread_pool::post_async_msg_(async_msg &&new_msg, async_overflow_policy overflow_policy)
{
if (overflow_policy == async_overflow_policy::block)
{
@@ -68,7 +68,7 @@ void SPDLOG_INLINE spdlog::details::thread_pool::post_async_msg_(async_msg &&new
}
}
-void SPDLOG_INLINE spdlog::details::thread_pool::worker_loop_()
+void SPDLOG_INLINE thread_pool::worker_loop_()
{
while (process_next_msg_()) {};
}
@@ -76,7 +76,7 @@ void SPDLOG_INLINE spdlog::details::thread_pool::worker_loop_()
// process next message in the queue
// return true if this thread should still be active (while no terminate msg
// was received)
-bool SPDLOG_INLINE spdlog::details::thread_pool::process_next_msg_()
+bool SPDLOG_INLINE thread_pool::process_next_msg_()
{
async_msg incoming_async_msg;
bool dequeued = q_.dequeue_for(incoming_async_msg, std::chrono::seconds(10));
@@ -107,3 +107,6 @@ bool SPDLOG_INLINE spdlog::details::thread_pool::process_next_msg_()
assert(false && "Unexpected async_msg_type");
return true;
}
+
+} // namespace details
+} // namespace spdlog
diff --git a/include/spdlog/details/thread_pool.h b/include/spdlog/details/thread_pool.h
index cc14bb39..42761d7a 100644
--- a/include/spdlog/details/thread_pool.h
+++ b/include/spdlog/details/thread_pool.h
@@ -57,8 +57,7 @@ struct async_msg
msg_id(other.msg_id),
source(other.source),
worker_ptr(std::move(other.worker_ptr))
- {
- }
+ {}
async_msg &operator=(async_msg &&other) SPDLOG_NOEXCEPT
{
@@ -98,13 +97,11 @@ struct async_msg
, msg_id(0)
, source()
, worker_ptr(std::move(worker))
- {
- }
+ {}
explicit async_msg(async_msg_type the_type)
: async_msg(nullptr, the_type)
- {
- }
+ {}
// copy into log_msg
log_msg to_log_msg()
@@ -154,6 +151,6 @@ private:
} // namespace details
} // namespace spdlog
-#ifndef SPDLOG_STATIC_LIB
+#ifdef SPDLOG_HEADER_ONLY
#include "thread_pool-inl.h"
#endif \ No newline at end of file
diff --git a/include/spdlog/fmt/bin_to_hex.h b/include/spdlog/fmt/bin_to_hex.h
index 35233802..4a091dde 100644
--- a/include/spdlog/fmt/bin_to_hex.h
+++ b/include/spdlog/fmt/bin_to_hex.h
@@ -31,8 +31,7 @@ public:
bytes_range(It range_begin, It range_end)
: begin_(range_begin)
, end_(range_end)
- {
- }
+ {}
It begin() const
{
diff --git a/include/spdlog/fmt/fmt.h b/include/spdlog/fmt/fmt.h
index c8f47158..5d039b8c 100644
--- a/include/spdlog/fmt/fmt.h
+++ b/include/spdlog/fmt/fmt.h
@@ -11,7 +11,7 @@
//
#if !defined(SPDLOG_FMT_EXTERNAL)
-#ifndef SPDLOG_STATIC_LIB
+#ifdef SPDLOG_HEADER_ONLY
#ifndef FMT_HEADER_ONLY
#define FMT_HEADER_ONLY
#endif
diff --git a/include/spdlog/logger-inl.h b/include/spdlog/logger-inl.h
index c0d13f11..4d0c5e24 100644
--- a/include/spdlog/logger-inl.h
+++ b/include/spdlog/logger-inl.h
@@ -6,8 +6,9 @@
#include "spdlog/sinks/sink.h"
#include "spdlog/details/pattern_formatter.h"
+namespace spdlog {
// public methods
-SPDLOG_INLINE void spdlog::logger::log(spdlog::source_loc loc, spdlog::level::level_enum lvl, const char *msg)
+SPDLOG_INLINE void logger::log(source_loc loc, level::level_enum lvl, const char *msg)
{
if (!should_log(lvl))
{
@@ -16,7 +17,7 @@ SPDLOG_INLINE void spdlog::logger::log(spdlog::source_loc loc, spdlog::level::le
try
{
- details::log_msg log_msg(loc, &name_, lvl, spdlog::string_view_t(msg));
+ details::log_msg log_msg(loc, &name_, lvl, string_view_t(msg));
sink_it_(log_msg);
}
catch (const std::exception &ex)
@@ -29,39 +30,39 @@ SPDLOG_INLINE void spdlog::logger::log(spdlog::source_loc loc, spdlog::level::le
}
}
-SPDLOG_INLINE void spdlog::logger::log(level::level_enum lvl, const char *msg)
+SPDLOG_INLINE void logger::log(level::level_enum lvl, const char *msg)
{
log(source_loc{}, lvl, msg);
}
-SPDLOG_INLINE bool spdlog::logger::should_log(spdlog::level::level_enum msg_level) const
+SPDLOG_INLINE bool logger::should_log(level::level_enum msg_level) const
{
return msg_level >= level_.load(std::memory_order_relaxed);
}
-SPDLOG_INLINE void spdlog::logger::set_level(spdlog::level::level_enum log_level)
+SPDLOG_INLINE void logger::set_level(level::level_enum log_level)
{
level_.store(log_level);
}
-SPDLOG_INLINE spdlog::level::level_enum spdlog::logger::default_level()
+SPDLOG_INLINE level::level_enum logger::default_level()
{
- return static_cast<spdlog::level::level_enum>(SPDLOG_ACTIVE_LEVEL);
+ return static_cast<level::level_enum>(SPDLOG_ACTIVE_LEVEL);
}
-SPDLOG_INLINE spdlog::level::level_enum spdlog::logger::level() const
+SPDLOG_INLINE level::level_enum logger::level() const
{
- return static_cast<spdlog::level::level_enum>(level_.load(std::memory_order_relaxed));
+ return static_cast<level::level_enum>(level_.load(std::memory_order_relaxed));
}
-SPDLOG_INLINE const std::string &spdlog::logger::name() const
+SPDLOG_INLINE const std::string &logger::name() const
{
return name_;
}
// set formatting for the sinks in this logger.
// each sink will get a seperate instance of the formatter object.
-SPDLOG_INLINE void spdlog::logger::set_formatter(std::unique_ptr<spdlog::formatter> f)
+SPDLOG_INLINE void logger::set_formatter(std::unique_ptr<formatter> f)
{
for (auto &sink : sinks_)
{
@@ -69,14 +70,14 @@ SPDLOG_INLINE void spdlog::logger::set_formatter(std::unique_ptr<spdlog::formatt
}
}
-SPDLOG_INLINE void spdlog::logger::set_pattern(std::string pattern, spdlog::pattern_time_type time_type)
+SPDLOG_INLINE void logger::set_pattern(std::string pattern, pattern_time_type time_type)
{
- auto new_formatter = details::make_unique<spdlog::pattern_formatter>(std::move(pattern), time_type);
+ auto new_formatter = details::make_unique<pattern_formatter>(std::move(pattern), time_type);
set_formatter(std::move(new_formatter));
}
// flush functions
-SPDLOG_INLINE void spdlog::logger::flush()
+SPDLOG_INLINE void logger::flush()
{
try
{
@@ -92,37 +93,37 @@ SPDLOG_INLINE void spdlog::logger::flush()
}
}
-SPDLOG_INLINE void spdlog::logger::flush_on(level::level_enum log_level)
+SPDLOG_INLINE void logger::flush_on(level::level_enum log_level)
{
flush_level_.store(log_level);
}
-SPDLOG_INLINE spdlog::level::level_enum spdlog::logger::flush_level() const
+SPDLOG_INLINE level::level_enum logger::flush_level() const
{
- return static_cast<spdlog::level::level_enum>(flush_level_.load(std::memory_order_relaxed));
+ return static_cast<level::level_enum>(flush_level_.load(std::memory_order_relaxed));
}
// sinks
-SPDLOG_INLINE const std::vector<spdlog::sink_ptr> &spdlog::logger::sinks() const
+SPDLOG_INLINE const std::vector<sink_ptr> &logger::sinks() const
{
return sinks_;
}
-SPDLOG_INLINE std::vector<spdlog::sink_ptr> &spdlog::logger::sinks()
+SPDLOG_INLINE std::vector<sink_ptr> &logger::sinks()
{
return sinks_;
}
// error handler
-SPDLOG_INLINE void spdlog::logger::set_error_handler(err_handler handler)
+SPDLOG_INLINE void logger::set_error_handler(err_handler handler)
{
custom_err_handler_ = handler;
}
// create new logger with same sinks and configuration.
-SPDLOG_INLINE std::shared_ptr<spdlog::logger> spdlog::logger::clone(std::string logger_name)
+SPDLOG_INLINE std::shared_ptr<logger> logger::clone(std::string logger_name)
{
- auto cloned = std::make_shared<spdlog::logger>(std::move(logger_name), sinks_.begin(), sinks_.end());
+ auto cloned = std::make_shared<logger>(std::move(logger_name), sinks_.begin(), sinks_.end());
cloned->set_level(this->level());
cloned->flush_on(this->flush_level());
cloned->set_error_handler(this->custom_err_handler_);
@@ -130,7 +131,7 @@ SPDLOG_INLINE std::shared_ptr<spdlog::logger> spdlog::logger::clone(std::string
}
// protected methods
-SPDLOG_INLINE void spdlog::logger::sink_it_(spdlog::details::log_msg &msg)
+SPDLOG_INLINE void logger::sink_it_(details::log_msg &msg)
{
for (auto &sink : sinks_)
{
@@ -146,7 +147,7 @@ SPDLOG_INLINE void spdlog::logger::sink_it_(spdlog::details::log_msg &msg)
}
}
-SPDLOG_INLINE void spdlog::logger::flush_()
+SPDLOG_INLINE void logger::flush_()
{
for (auto &sink : sinks_)
{
@@ -154,13 +155,13 @@ SPDLOG_INLINE void spdlog::logger::flush_()
}
}
-SPDLOG_INLINE bool spdlog::logger::should_flush_(const spdlog::details::log_msg &msg)
+SPDLOG_INLINE bool logger::should_flush_(const details::log_msg &msg)
{
auto flush_level = flush_level_.load(std::memory_order_relaxed);
return (msg.level >= flush_level) && (msg.level != level::off);
}
-SPDLOG_INLINE void spdlog::logger::err_handler_(const std::string &msg)
+SPDLOG_INLINE void logger::err_handler_(const std::string &msg)
{
if (custom_err_handler_)
{
@@ -168,9 +169,10 @@ SPDLOG_INLINE void spdlog::logger::err_handler_(const std::string &msg)
}
else
{
- auto tm_time = spdlog::details::os::localtime();
+ auto tm_time = details::os::localtime();
char date_buf[64];
std::strftime(date_buf, sizeof(date_buf), "%Y-%m-%d %H:%M:%S", &tm_time);
fmt::print(stderr, "[*** LOG ERROR ***] [{}] [{}] {}\n", date_buf, name(), msg);
}
}
+} // namespace spdlog \ No newline at end of file
diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h
index 21814121..89fed05d 100644
--- a/include/spdlog/logger.h
+++ b/include/spdlog/logger.h
@@ -35,17 +35,14 @@ public:
logger(std::string name, It begin, It end)
: name_(std::move(name))
, sinks_(begin, end)
- {
- }
+ {}
logger(std::string name, sink_ptr single_sink)
: logger(std::move(name), {std::move(single_sink)})
- {
- }
+ {}
logger(std::string name, sinks_init_list sinks)
: logger(std::move(name), sinks.begin(), sinks.end())
- {
- }
+ {}
virtual ~logger() = default;
@@ -338,6 +335,6 @@ protected:
};
} // namespace spdlog
-#ifndef SPDLOG_STATIC_LIB
+#ifdef SPDLOG_HEADER_ONLY
#include "logger-inl.h"
#endif
diff --git a/include/spdlog/sinks/android_sink.h b/include/spdlog/sinks/android_sink.h
index 70073ae4..52b1ac8c 100644
--- a/include/spdlog/sinks/android_sink.h
+++ b/include/spdlog/sinks/android_sink.h
@@ -35,8 +35,7 @@ public:
explicit android_sink(std::string tag = "spdlog", bool use_raw_msg = false)
: tag_(std::move(tag))
, use_raw_msg_(use_raw_msg)
- {
- }
+ {}
protected:
void sink_it_(const details::log_msg &msg) override
diff --git a/include/spdlog/sinks/ansicolor_sink.h b/include/spdlog/sinks/ansicolor_sink.h
index 1eb8c931..08a30aae 100644
--- a/include/spdlog/sinks/ansicolor_sink.h
+++ b/include/spdlog/sinks/ansicolor_sink.h
@@ -89,6 +89,6 @@ using ansicolor_stderr_sink_st = ansicolor_sink<details::console_stderr, details
} // namespace sinks
} // namespace spdlog
-#ifndef SPDLOG_STATIC_LIB
+#ifdef SPDLOG_HEADER_ONLY
#include "ansicolor_sink-inl.h"
#endif \ No newline at end of file
diff --git a/include/spdlog/sinks/ostream_sink.h b/include/spdlog/sinks/ostream_sink.h
index f060ecde..4cc5fb38 100644
--- a/include/spdlog/sinks/ostream_sink.h
+++ b/include/spdlog/sinks/ostream_sink.h
@@ -22,8 +22,7 @@ public:
explicit ostream_sink(std::ostream &os, bool force_flush = false)
: ostream_(os)
, force_flush_(force_flush)
- {
- }
+ {}
ostream_sink(const ostream_sink &) = delete;
ostream_sink &operator=(const ostream_sink &) = delete;
diff --git a/include/spdlog/sinks/sink-inl.h b/include/spdlog/sinks/sink-inl.h
index 1ec317a3..8599795c 100644
--- a/include/spdlog/sinks/sink-inl.h
+++ b/include/spdlog/sinks/sink-inl.h
@@ -8,13 +8,11 @@
SPDLOG_INLINE spdlog::sinks::sink::sink()
: formatter_{details::make_unique<spdlog::pattern_formatter>()}
-{
-}
+{}
SPDLOG_INLINE spdlog::sinks::sink::sink(std::unique_ptr<spdlog::formatter> formatter)
: formatter_{std::move(formatter)}
-{
-}
+{}
SPDLOG_INLINE bool spdlog::sinks::sink::should_log(spdlog::level::level_enum msg_level) const
{
diff --git a/include/spdlog/sinks/sink.h b/include/spdlog/sinks/sink.h
index 2c5ef9bd..263cbe5b 100644
--- a/include/spdlog/sinks/sink.h
+++ b/include/spdlog/sinks/sink.h
@@ -38,6 +38,6 @@ protected:
} // namespace sinks
} // namespace spdlog
-#ifndef SPDLOG_STATIC_LIB
+#ifdef SPDLOG_HEADER_ONLY
#include "sink-inl.h"
#endif
diff --git a/include/spdlog/sinks/stdout_sinks.h b/include/spdlog/sinks/stdout_sinks.h
index 6b7fd3ec..91274c11 100644
--- a/include/spdlog/sinks/stdout_sinks.h
+++ b/include/spdlog/sinks/stdout_sinks.h
@@ -26,8 +26,7 @@ public:
stdout_sink()
: mutex_(ConsoleMutex::mutex())
, file_(TargetStream::stream())
- {
- }
+ {}
~stdout_sink() override = default;
stdout_sink(const stdout_sink &other) = delete;
diff --git a/src/format.cc b/src/format.cc
deleted file mode 100644
index f2a014da..00000000
--- a/src/format.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2012 - 2016, Victor Zverovich
-// All rights reserved.
-//
-// For the license information refer to format.h.
-
-
-// Slightly modified version of fmt lib to include bundled format-inl.h
-
-
-#if !defined(SPDLOG_FMT_EXTERNAL)
-#include "spdlog/fmt/bundled/format-inl.h"
-#else
-#include "fmt/format-inl.h"
-#endif
-
-FMT_BEGIN_NAMESPACE
- template struct internal::basic_data<void>;
- template FMT_API internal::locale_ref::locale_ref(const std::locale &loc);
- template FMT_API std::locale internal::locale_ref::get<std::locale>() const;
-
-// Explicit instantiations for char.
-
- template FMT_API char internal::thousands_sep_impl(locale_ref);
-
- template FMT_API void internal::basic_buffer<char>::append(const char *, const char *);
-
- template FMT_API void internal::arg_map<format_context>::init(
- const basic_format_args<format_context> &args);
-
- template FMT_API int internal::char_traits<char>::format_float(
- char *, std::size_t, const char *, int, double);
-
- template FMT_API int internal::char_traits<char>::format_float(
- char *, std::size_t, const char *, int, long double);
-
- template FMT_API std::string internal::vformat<char>(
- string_view, basic_format_args<format_context>);
-
- template FMT_API format_context::iterator internal::vformat_to(
- internal::buffer &, string_view, basic_format_args<format_context>);
-
- template FMT_API void internal::sprintf_format(
- double, internal::buffer &, core_format_specs);
- template FMT_API void internal::sprintf_format(
- long double, internal::buffer &, core_format_specs);
-
-// Explicit instantiations for wchar_t.
-
- template FMT_API wchar_t internal::thousands_sep_impl(locale_ref);
-
- template FMT_API void internal::basic_buffer<wchar_t>::append(
- const wchar_t *, const wchar_t *);
-
- template FMT_API void internal::arg_map<wformat_context>::init(
- const basic_format_args<wformat_context> &);
-
- template FMT_API int internal::char_traits<wchar_t>::format_float(
- wchar_t *, std::size_t, const wchar_t *, int, double);
-
- template FMT_API int internal::char_traits<wchar_t>::format_float(
- wchar_t *, std::size_t, const wchar_t *, int, long double);
-
- template FMT_API std::wstring internal::vformat<wchar_t>(
- wstring_view, basic_format_args<wformat_context>);
-FMT_END_NAMESPACE
diff --git a/src/format.cpp b/src/format.cpp
new file mode 100644
index 00000000..0a98d58b
--- /dev/null
+++ b/src/format.cpp
@@ -0,0 +1,51 @@
+// Copyright (c) 2012 - 2016, Victor Zverovich
+// All rights reserved.
+//
+// For the license information refer to format.h.
+
+// Slightly modified version of fmt lib to include bundled format-inl.h
+
+#if !defined(SPDLOG_FMT_EXTERNAL)
+#include "spdlog/fmt/bundled/format-inl.h"
+#else
+#include "fmt/format-inl.h"
+#endif
+
+FMT_BEGIN_NAMESPACE
+template struct internal::basic_data<void>;
+template FMT_API internal::locale_ref::locale_ref(const std::locale &loc);
+template FMT_API std::locale internal::locale_ref::get<std::locale>() const;
+
+// Explicit instantiations for char.
+
+template FMT_API char internal::thousands_sep_impl(locale_ref);
+
+template FMT_API void internal::basic_buffer<char>::append(const char *, const char *);
+
+template FMT_API void internal::arg_map<format_context>::init(const basic_format_args<format_context> &args);
+
+template FMT_API int internal::char_traits<char>::format_float(char *, std::size_t, const char *, int, double);
+
+template FMT_API int internal::char_traits<char>::format_float(char *, std::size_t, const char *, int, long double);
+
+template FMT_API std::string internal::vformat<char>(string_view, basic_format_args<format_context>);
+
+template FMT_API format_context::iterator internal::vformat_to(internal::buffer &, string_view, basic_format_args<format_context>);
+
+template FMT_API void internal::sprintf_format(double, internal::buffer &, core_format_specs);
+template FMT_API void internal::sprintf_format(long double, internal::buffer &, core_format_specs);
+
+// Explicit instantiations for wchar_t.
+
+template FMT_API wchar_t internal::thousands_sep_impl(locale_ref);
+
+template FMT_API void internal::basic_buffer<wchar_t>::append(const wchar_t *, const wchar_t *);
+
+template FMT_API void internal::arg_map<wformat_context>::init(const basic_format_args<wformat_context> &);
+
+template FMT_API int internal::char_traits<wchar_t>::format_float(wchar_t *, std::size_t, const wchar_t *, int, double);
+
+template FMT_API int internal::char_traits<wchar_t>::format_float(wchar_t *, std::size_t, const wchar_t *, int, long double);
+
+template FMT_API std::wstring internal::vformat<wchar_t>(wstring_view, basic_format_args<wformat_context>);
+FMT_END_NAMESPACE
diff --git a/src/spdlog.cpp b/src/spdlog.cpp
index 465812c5..7c75ca31 100644
--- a/src/spdlog.cpp
+++ b/src/spdlog.cpp
@@ -2,11 +2,11 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#include <mutex>
+#include <chrono>
#include "spdlog/common.h"
#include "spdlog/common-inl.h"
-
#include "spdlog/details/null_mutex.h"
#include "spdlog/logger.h"
@@ -51,3 +51,8 @@ template class spdlog::sinks::ansicolor_sink<spdlog::details::console_stdout, sp
template class spdlog::sinks::ansicolor_sink<spdlog::details::console_stdout, spdlog::details::console_nullmutex>;
template class spdlog::sinks::ansicolor_sink<spdlog::details::console_stderr, spdlog::details::console_mutex>;
template class spdlog::sinks::ansicolor_sink<spdlog::details::console_stderr, spdlog::details::console_nullmutex>;
+
+// fmt_helper templates
+#include "spdlog/details/fmt_helper.h"
+template void spdlog::details::fmt_helper::append_string_view(spdlog::string_view_t view, fmt::memory_buffer &dest);
+template spdlog::string_view_t spdlog::details::fmt_helper::to_string_view(const fmt::memory_buffer &buf) SPDLOG_NOEXCEPT;
diff --git a/tests/test_errors.cpp b/tests/test_errors.cpp
index 24075634..65185d3c 100644
--- a/tests/test_errors.cpp
+++ b/tests/test_errors.cpp
@@ -39,8 +39,7 @@ TEST_CASE("default_error_handler", "[errors]]")
}
struct custom_ex
-{
-};
+{};
TEST_CASE("custom_error_handler", "[errors]]")
{
prepare_logdir();