mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 10:29:02 +08:00
Bump fmt to version 8.1.1 and run clang-format
This commit is contained in:
@@ -73,7 +73,8 @@ inline std::shared_ptr<spdlog::logger> create_async_nb(std::string logger_name,
|
||||
}
|
||||
|
||||
// set global thread pool.
|
||||
inline void init_thread_pool(size_t q_size, size_t thread_count, std::function<void()> on_thread_start, std::function<void()> on_thread_stop)
|
||||
inline void init_thread_pool(
|
||||
size_t q_size, size_t thread_count, std::function<void()> on_thread_start, std::function<void()> on_thread_stop)
|
||||
{
|
||||
auto tp = std::make_shared<details::thread_pool>(q_size, thread_count, on_thread_start, on_thread_stop);
|
||||
details::registry::instance().set_tp(std::move(tp));
|
||||
@@ -86,7 +87,8 @@ inline void init_thread_pool(size_t q_size, size_t thread_count, std::function<v
|
||||
|
||||
inline void init_thread_pool(size_t q_size, size_t thread_count)
|
||||
{
|
||||
init_thread_pool(q_size, thread_count, [] {}, [] {});
|
||||
init_thread_pool(
|
||||
q_size, thread_count, [] {}, [] {});
|
||||
}
|
||||
|
||||
// get the global thread pool.
|
||||
|
@@ -331,7 +331,7 @@ template<bool B, class T = void>
|
||||
using enable_if_t = typename std::enable_if<B, T>::type;
|
||||
|
||||
template<typename T, typename... Args>
|
||||
std::unique_ptr<T> make_unique(Args &&...args)
|
||||
std::unique_ptr<T> make_unique(Args &&... args)
|
||||
{
|
||||
static_assert(!std::is_array<T>::value, "arrays not supported");
|
||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
|
@@ -84,7 +84,7 @@ SPDLOG_INLINE void file_helper::reopen(bool truncate)
|
||||
|
||||
SPDLOG_INLINE void file_helper::flush()
|
||||
{
|
||||
if(std::fflush(fd_) != 0)
|
||||
if (std::fflush(fd_) != 0)
|
||||
{
|
||||
throw_spdlog_ex("Failed flush to file " + os::filename_to_str(filename_), errno);
|
||||
}
|
||||
|
@@ -13,7 +13,8 @@
|
||||
namespace spdlog {
|
||||
namespace details {
|
||||
|
||||
SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, size_t threads_n, std::function<void()> on_thread_start, std::function<void()> on_thread_stop)
|
||||
SPDLOG_INLINE thread_pool::thread_pool(
|
||||
size_t q_max_items, size_t threads_n, std::function<void()> on_thread_start, std::function<void()> on_thread_stop)
|
||||
: q_(q_max_items)
|
||||
{
|
||||
if (threads_n == 0 || threads_n > 1000)
|
||||
@@ -36,7 +37,8 @@ SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, size_t threads_n, std
|
||||
{}
|
||||
|
||||
SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, size_t threads_n)
|
||||
: thread_pool(q_max_items, threads_n, [] {}, [] {})
|
||||
: thread_pool(
|
||||
q_max_items, threads_n, [] {}, [] {})
|
||||
{}
|
||||
|
||||
// message all threads to terminate gracefully join them
|
||||
|
@@ -9,11 +9,11 @@
|
||||
#include <spdlog/common.h>
|
||||
|
||||
#if defined(__has_include) && __has_include(<version>)
|
||||
#include <version>
|
||||
# include <version>
|
||||
#endif
|
||||
|
||||
#if __cpp_lib_span >= 202002L
|
||||
#include <span>
|
||||
# include <span>
|
||||
#endif
|
||||
|
||||
//
|
||||
@@ -78,8 +78,9 @@ inline details::dump_info<typename Container::const_iterator> to_hex(const Conta
|
||||
|
||||
#if __cpp_lib_span >= 202002L
|
||||
|
||||
template <typename Value, size_t Extent>
|
||||
inline details::dump_info<typename std::span<Value, Extent>::iterator> to_hex(const std::span<Value, Extent> &container, size_t size_per_line = 32)
|
||||
template<typename Value, size_t Extent>
|
||||
inline details::dump_info<typename std::span<Value, Extent>::iterator> to_hex(
|
||||
const std::span<Value, Extent> &container, size_t size_per_line = 32)
|
||||
{
|
||||
using Container = std::span<Value, Extent>;
|
||||
static_assert(sizeof(typename Container::value_type) == 1, "sizeof(Container::value_type) != 1");
|
||||
|
@@ -68,7 +68,7 @@ class SPDLOG_API custom_flag_formatter : public details::flag_formatter
|
||||
public:
|
||||
virtual std::unique_ptr<custom_flag_formatter> clone() const = 0;
|
||||
|
||||
void set_padding_info(const details::padding_info& padding)
|
||||
void set_padding_info(const details::padding_info &padding)
|
||||
{
|
||||
flag_formatter::padinfo_ = padding;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
using custom_flags = std::unordered_map<char, std::unique_ptr<custom_flag_formatter>>;
|
||||
|
||||
explicit pattern_formatter(std::string pattern, pattern_time_type time_type = pattern_time_type::local,
|
||||
std::string eol = spdlog::details::os::default_eol, custom_flags custom_user_flags = custom_flags());
|
||||
std::string eol = spdlog::details::os::default_eol, custom_flags custom_user_flags = custom_flags());
|
||||
|
||||
// use default pattern is not given
|
||||
explicit pattern_formatter(pattern_time_type time_type = pattern_time_type::local, std::string eol = spdlog::details::os::default_eol);
|
||||
|
@@ -31,7 +31,7 @@ SPDLOG_INLINE rotating_file_sink<Mutex>::rotating_file_sink(
|
||||
, max_files_(max_files)
|
||||
, file_helper_{event_handlers}
|
||||
{
|
||||
if(max_size == 0)
|
||||
if (max_size == 0)
|
||||
{
|
||||
throw_spdlog_ex("rotating sink constructor: max_size arg cannot be zero");
|
||||
}
|
||||
@@ -79,7 +79,7 @@ SPDLOG_INLINE void rotating_file_sink<Mutex>::sink_it_(const details::log_msg &m
|
||||
if (new_size > max_size_)
|
||||
{
|
||||
file_helper_.flush();
|
||||
if(file_helper_.size() > 0)
|
||||
if (file_helper_.size() > 0)
|
||||
{
|
||||
rotate_();
|
||||
new_size = formatted.size();
|
||||
|
Reference in New Issue
Block a user