diff --git a/Source/workspace/UILayout.xml b/Source/workspace/UILayout.xml
index 56fe68b8..9d2b9ffd 100644
--- a/Source/workspace/UILayout.xml
+++ b/Source/workspace/UILayout.xml
@@ -1,41 +1,40 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tool/spdlog/include/spdlog/async.h b/Tool/spdlog/include/spdlog/async.h
index 94f9f6d9..e96abd19 100644
--- a/Tool/spdlog/include/spdlog/async.h
+++ b/Tool/spdlog/include/spdlog/async.h
@@ -18,9 +18,9 @@
#include
#include
+#include
#include
#include
-#include
namespace spdlog {
@@ -31,12 +31,10 @@ static const size_t default_async_q_size = 8192;
// async logger factory - creates async loggers backed with thread pool.
// if a global thread pool doesn't already exist, create it with default queue
// size of 8192 items and single thread.
-template
-struct async_factory_impl
-{
- template
- static std::shared_ptr create(std::string logger_name, SinkArgs &&...args)
- {
+template
+struct async_factory_impl {
+ template
+ static std::shared_ptr create(std::string logger_name, SinkArgs &&...args) {
auto ®istry_inst = details::registry::instance();
// create global thread pool if not already exists..
@@ -44,14 +42,14 @@ struct async_factory_impl
auto &mutex = registry_inst.tp_mutex();
std::lock_guard tp_lock(mutex);
auto tp = registry_inst.get_tp();
- if (tp == nullptr)
- {
+ if (tp == nullptr) {
tp = std::make_shared(details::default_async_q_size, 1U);
registry_inst.set_tp(tp);
}
auto sink = std::make_shared(std::forward(args)...);
- auto new_logger = std::make_shared(std::move(logger_name), std::move(sink), std::move(tp), OverflowPolicy);
+ auto new_logger = std::make_shared(std::move(logger_name), std::move(sink),
+ std::move(tp), OverflowPolicy);
registry_inst.initialize_logger(new_logger);
return new_logger;
}
@@ -60,40 +58,43 @@ struct async_factory_impl
using async_factory = async_factory_impl;
using async_factory_nonblock = async_factory_impl;
-template
-inline std::shared_ptr create_async(std::string logger_name, SinkArgs &&...sink_args)
-{
- return async_factory::create(std::move(logger_name), std::forward(sink_args)...);
+template
+inline std::shared_ptr create_async(std::string logger_name,
+ SinkArgs &&...sink_args) {
+ return async_factory::create(std::move(logger_name),
+ std::forward(sink_args)...);
}
-template
-inline std::shared_ptr create_async_nb(std::string logger_name, SinkArgs &&...sink_args)
-{
- return async_factory_nonblock::create(std::move(logger_name), std::forward(sink_args)...);
+template
+inline std::shared_ptr create_async_nb(std::string logger_name,
+ SinkArgs &&...sink_args) {
+ return async_factory_nonblock::create(std::move(logger_name),
+ std::forward(sink_args)...);
}
// set global thread pool.
-inline void init_thread_pool(
- size_t q_size, size_t thread_count, std::function on_thread_start, std::function on_thread_stop)
-{
- auto tp = std::make_shared(q_size, thread_count, on_thread_start, on_thread_stop);
+inline void init_thread_pool(size_t q_size,
+ size_t thread_count,
+ std::function on_thread_start,
+ std::function on_thread_stop) {
+ auto tp = std::make_shared(q_size, thread_count, on_thread_start,
+ on_thread_stop);
details::registry::instance().set_tp(std::move(tp));
}
-inline void init_thread_pool(size_t q_size, size_t thread_count, std::function on_thread_start)
-{
+inline void init_thread_pool(size_t q_size,
+ size_t thread_count,
+ std::function on_thread_start) {
init_thread_pool(q_size, thread_count, on_thread_start, [] {});
}
-inline void init_thread_pool(size_t q_size, size_t thread_count)
-{
+inline void init_thread_pool(size_t q_size, size_t thread_count) {
init_thread_pool(
q_size, thread_count, [] {}, [] {});
}
// get the global thread pool.
-inline std::shared_ptr thread_pool()
-{
+inline std::shared_ptr thread_pool() {
return details::registry::instance().get_tp();
}
-} // namespace spdlog
+} // namespace spdlog
diff --git a/Tool/spdlog/include/spdlog/async_logger-inl.h b/Tool/spdlog/include/spdlog/async_logger-inl.h
index 4de8382a..1e794798 100644
--- a/Tool/spdlog/include/spdlog/async_logger-inl.h
+++ b/Tool/spdlog/include/spdlog/async_logger-inl.h
@@ -4,31 +4,38 @@
#pragma once
#ifndef SPDLOG_HEADER_ONLY
-# include
+ #include
#endif
-#include
#include
+#include
#include
#include
-SPDLOG_INLINE spdlog::async_logger::async_logger(
- std::string logger_name, sinks_init_list sinks_list, std::weak_ptr 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,
+ sinks_init_list sinks_list,
+ std::weak_ptr 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 tp, async_overflow_policy overflow_policy)
- : async_logger(std::move(logger_name), {std::move(single_sink)}, std::move(tp), overflow_policy)
-{}
+SPDLOG_INLINE spdlog::async_logger::async_logger(std::string logger_name,
+ sink_ptr single_sink,
+ std::weak_ptr 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_(const details::log_msg &msg){
- SPDLOG_TRY{if (auto pool_ptr = thread_pool_.lock()){pool_ptr->post_log(shared_from_this(), msg, overflow_policy_);
+ SPDLOG_TRY{if (auto pool_ptr = thread_pool_.lock()){
+ pool_ptr->post_log(shared_from_this(), msg, overflow_policy_);
}
-else
-{
+else {
throw_spdlog_ex("async log: thread pool doesn't exist anymore");
}
}
@@ -37,10 +44,10 @@ SPDLOG_LOGGER_CATCH(msg.source)
// send flush request to the thread pool
SPDLOG_INLINE void spdlog::async_logger::flush_(){
- SPDLOG_TRY{if (auto pool_ptr = thread_pool_.lock()){pool_ptr->post_flush(shared_from_this(), overflow_policy_);
+ SPDLOG_TRY{if (auto pool_ptr = thread_pool_.lock()){
+ pool_ptr->post_flush(shared_from_this(), overflow_policy_);
}
-else
-{
+else {
throw_spdlog_ex("async flush: thread pool doesn't exist anymore");
}
}
@@ -50,40 +57,27 @@ SPDLOG_LOGGER_CATCH(source_loc())
//
// backend functions - called from the thread pool to do the actual job
//
-SPDLOG_INLINE void spdlog::async_logger::backend_sink_it_(const details::log_msg &msg)
-{
- for (auto &sink : sinks_)
- {
- if (sink->should_log(msg.level))
- {
- SPDLOG_TRY
- {
- sink->log(msg);
- }
+SPDLOG_INLINE void spdlog::async_logger::backend_sink_it_(const details::log_msg &msg) {
+ for (auto &sink : sinks_) {
+ if (sink->should_log(msg.level)) {
+ SPDLOG_TRY { sink->log(msg); }
SPDLOG_LOGGER_CATCH(msg.source)
}
}
- if (should_flush_(msg))
- {
+ if (should_flush_(msg)) {
backend_flush_();
}
}
-SPDLOG_INLINE void spdlog::async_logger::backend_flush_()
-{
- for (auto &sink : sinks_)
- {
- SPDLOG_TRY
- {
- sink->flush();
- }
+SPDLOG_INLINE void spdlog::async_logger::backend_flush_() {
+ for (auto &sink : sinks_) {
+ SPDLOG_TRY { sink->flush(); }
SPDLOG_LOGGER_CATCH(source_loc())
}
}
-SPDLOG_INLINE std::shared_ptr spdlog::async_logger::clone(std::string new_name)
-{
+SPDLOG_INLINE std::shared_ptr spdlog::async_logger::clone(std::string new_name) {
auto cloned = std::make_shared(*this);
cloned->name_ = std::move(new_name);
return cloned;
diff --git a/Tool/spdlog/include/spdlog/async_logger.h b/Tool/spdlog/include/spdlog/async_logger.h
index 91a93fcb..846c4c6f 100644
--- a/Tool/spdlog/include/spdlog/async_logger.h
+++ b/Tool/spdlog/include/spdlog/async_logger.h
@@ -19,35 +19,41 @@
namespace spdlog {
// Async overflow policy - block by default.
-enum class async_overflow_policy
-{
- block, // Block until message can be enqueued
- overrun_oldest // Discard oldest message in the queue if full when trying to
- // add new item.
+enum class async_overflow_policy {
+ block, // Block until message can be enqueued
+ overrun_oldest, // Discard oldest message in the queue if full when trying to
+ // add new item.
+ discard_new // Discard new message if the queue is full when trying to add new item.
};
namespace details {
class thread_pool;
}
-class SPDLOG_API async_logger final : public std::enable_shared_from_this, public logger
-{
+class SPDLOG_API async_logger final : public std::enable_shared_from_this,
+ public logger {
friend class details::thread_pool;
public:
- template
- async_logger(std::string logger_name, It begin, It end, std::weak_ptr tp,
- async_overflow_policy overflow_policy = async_overflow_policy::block)
- : logger(std::move(logger_name), begin, end)
- , thread_pool_(std::move(tp))
- , overflow_policy_(overflow_policy)
- {}
+ template
+ async_logger(std::string logger_name,
+ It begin,
+ It end,
+ std::weak_ptr tp,
+ async_overflow_policy overflow_policy = async_overflow_policy::block)
+ : logger(std::move(logger_name), begin, end),
+ thread_pool_(std::move(tp)),
+ overflow_policy_(overflow_policy) {}
- async_logger(std::string logger_name, sinks_init_list sinks_list, std::weak_ptr tp,
- async_overflow_policy overflow_policy = async_overflow_policy::block);
+ async_logger(std::string logger_name,
+ sinks_init_list sinks_list,
+ std::weak_ptr tp,
+ async_overflow_policy overflow_policy = async_overflow_policy::block);
- async_logger(std::string logger_name, sink_ptr single_sink, std::weak_ptr tp,
- async_overflow_policy overflow_policy = async_overflow_policy::block);
+ async_logger(std::string logger_name,
+ sink_ptr single_sink,
+ std::weak_ptr tp,
+ async_overflow_policy overflow_policy = async_overflow_policy::block);
std::shared_ptr clone(std::string new_name) override;
@@ -61,8 +67,8 @@ private:
std::weak_ptr thread_pool_;
async_overflow_policy overflow_policy_;
};
-} // namespace spdlog
+} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
-# include "async_logger-inl.h"
+ #include "async_logger-inl.h"
#endif
diff --git a/Tool/spdlog/include/spdlog/cfg/argv.h b/Tool/spdlog/include/spdlog/cfg/argv.h
index 36d9f1c4..7de2f83e 100644
--- a/Tool/spdlog/include/spdlog/cfg/argv.h
+++ b/Tool/spdlog/include/spdlog/cfg/argv.h
@@ -21,24 +21,20 @@ namespace spdlog {
namespace cfg {
// search for SPDLOG_LEVEL= in the args and use it to init the levels
-inline void load_argv_levels(int argc, const char **argv)
-{
+inline void load_argv_levels(int argc, const char **argv) {
const std::string spdlog_level_prefix = "SPDLOG_LEVEL=";
- for (int i = 1; i < argc; i++)
- {
+ for (int i = 1; i < argc; i++) {
std::string arg = argv[i];
- if (arg.find(spdlog_level_prefix) == 0)
- {
+ if (arg.find(spdlog_level_prefix) == 0) {
auto levels_string = arg.substr(spdlog_level_prefix.size());
helpers::load_levels(levels_string);
}
}
}
-inline void load_argv_levels(int argc, char **argv)
-{
+inline void load_argv_levels(int argc, char **argv) {
load_argv_levels(argc, const_cast(argv));
}
-} // namespace cfg
-} // namespace spdlog
+} // namespace cfg
+} // namespace spdlog
diff --git a/Tool/spdlog/include/spdlog/cfg/env.h b/Tool/spdlog/include/spdlog/cfg/env.h
index 1f39ebbb..6e554145 100644
--- a/Tool/spdlog/include/spdlog/cfg/env.h
+++ b/Tool/spdlog/include/spdlog/cfg/env.h
@@ -3,8 +3,8 @@
#pragma once
#include
-#include
#include
+#include
//
// Init levels and patterns from env variables SPDLOG_LEVEL
@@ -25,14 +25,12 @@
namespace spdlog {
namespace cfg {
-inline void load_env_levels()
-{
+inline void load_env_levels() {
auto env_val = details::os::getenv("SPDLOG_LEVEL");
- if (!env_val.empty())
- {
+ if (!env_val.empty()) {
helpers::load_levels(env_val);
}
}
-} // namespace cfg
-} // namespace spdlog
+} // namespace cfg
+} // namespace spdlog
diff --git a/Tool/spdlog/include/spdlog/cfg/helpers-inl.h b/Tool/spdlog/include/spdlog/cfg/helpers-inl.h
index 675a13af..93650a2e 100644
--- a/Tool/spdlog/include/spdlog/cfg/helpers-inl.h
+++ b/Tool/spdlog/include/spdlog/cfg/helpers-inl.h
@@ -4,33 +4,32 @@
#pragma once
#ifndef SPDLOG_HEADER_ONLY
-# include
+ #include
#endif
-#include
#include
#include
+#include
#include
+#include
#include
#include
-#include
namespace spdlog {
namespace cfg {
namespace helpers {
// inplace convert to lowercase
-inline std::string &to_lower_(std::string &str)
-{
- std::transform(
- str.begin(), str.end(), str.begin(), [](char ch) { return static_cast((ch >= 'A' && ch <= 'Z') ? ch + ('a' - 'A') : ch); });
+inline std::string &to_lower_(std::string &str) {
+ std::transform(str.begin(), str.end(), str.begin(), [](char ch) {
+ return static_cast((ch >= 'A' && ch <= 'Z') ? ch + ('a' - 'A') : ch);
+ });
return str;
}
// inplace trim spaces
-inline std::string &trim_(std::string &str)
-{
+inline std::string &trim_(std::string &str) {
const char *spaces = " \n\r\t";
str.erase(str.find_last_not_of(spaces) + 1);
str.erase(0, str.find_first_not_of(spaces));
@@ -44,16 +43,12 @@ inline std::string &trim_(std::string &str)
// "key=" => ("key", "")
// "val" => ("", "val")
-inline std::pair extract_kv_(char sep, const std::string &str)
-{
+inline std::pair extract_kv_(char sep, const std::string &str) {
auto n = str.find(sep);
std::string k, v;
- if (n == std::string::npos)
- {
+ if (n == std::string::npos) {
v = str;
- }
- else
- {
+ } else {
k = str.substr(0, n);
v = str.substr(n + 1);
}
@@ -62,15 +57,12 @@ inline std::pair extract_kv_(char sep, const std::stri
// return vector of key/value pairs from sequence of "K1=V1,K2=V2,.."
// "a=AAA,b=BBB,c=CCC,.." => {("a","AAA"),("b","BBB"),("c", "CCC"),...}
-inline std::unordered_map extract_key_vals_(const std::string &str)
-{
+inline std::unordered_map extract_key_vals_(const std::string &str) {
std::string token;
std::istringstream token_stream(str);
std::unordered_map rv{};
- while (std::getline(token_stream, token, ','))
- {
- if (token.empty())
- {
+ while (std::getline(token_stream, token, ',')) {
+ if (token.empty()) {
continue;
}
auto kv = extract_kv_('=', token);
@@ -79,10 +71,8 @@ inline std::unordered_map extract_key_vals_(const std:
return rv;
}
-SPDLOG_INLINE void load_levels(const std::string &input)
-{
- if (input.empty() || input.size() > 512)
- {
+SPDLOG_INLINE void load_levels(const std::string &input) {
+ if (input.empty() || input.size() > 512) {
return;
}
@@ -91,30 +81,27 @@ SPDLOG_INLINE void load_levels(const std::string &input)
level::level_enum global_level = level::info;
bool global_level_found = false;
- for (auto &name_level : key_vals)
- {
+ for (auto &name_level : key_vals) {
auto &logger_name = name_level.first;
auto level_name = to_lower_(name_level.second);
auto level = level::from_str(level_name);
// ignore unrecognized level names
- if (level == level::off && level_name != "off")
- {
+ if (level == level::off && level_name != "off") {
continue;
}
- if (logger_name.empty()) // no logger name indicate global level
+ if (logger_name.empty()) // no logger name indicate global level
{
global_level_found = true;
global_level = level;
- }
- else
- {
+ } else {
levels[logger_name] = level;
}
}
- details::registry::instance().set_levels(std::move(levels), global_level_found ? &global_level : nullptr);
+ details::registry::instance().set_levels(std::move(levels),
+ global_level_found ? &global_level : nullptr);
}
-} // namespace helpers
-} // namespace cfg
-} // namespace spdlog
+} // namespace helpers
+} // namespace cfg
+} // namespace spdlog
diff --git a/Tool/spdlog/include/spdlog/cfg/helpers.h b/Tool/spdlog/include/spdlog/cfg/helpers.h
index ab7584e0..c0238189 100644
--- a/Tool/spdlog/include/spdlog/cfg/helpers.h
+++ b/Tool/spdlog/include/spdlog/cfg/helpers.h
@@ -19,11 +19,11 @@ namespace helpers {
// turn off all logging except for logger1 and logger2: "off,logger1=debug,logger2=info"
//
SPDLOG_API void load_levels(const std::string &txt);
-} // namespace helpers
+} // namespace helpers
-} // namespace cfg
-} // namespace spdlog
+} // namespace cfg
+} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
-# include "helpers-inl.h"
-#endif // SPDLOG_HEADER_ONLY
+ #include "helpers-inl.h"
+#endif // SPDLOG_HEADER_ONLY
diff --git a/Tool/spdlog/include/spdlog/common-inl.h b/Tool/spdlog/include/spdlog/common-inl.h
index 728f9831..a8a0453c 100644
--- a/Tool/spdlog/include/spdlog/common-inl.h
+++ b/Tool/spdlog/include/spdlog/common-inl.h
@@ -4,7 +4,7 @@
#pragma once
#ifndef SPDLOG_HEADER_ONLY
-# include
+ #include
#endif
#include
@@ -20,41 +20,34 @@ constexpr
static const char *short_level_names[] SPDLOG_SHORT_LEVEL_NAMES;
-SPDLOG_INLINE const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
-{
+SPDLOG_INLINE const 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
-{
+SPDLOG_INLINE const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT {
return short_level_names[l];
}
-SPDLOG_INLINE spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT
-{
+SPDLOG_INLINE spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT {
auto it = std::find(std::begin(level_string_views), std::end(level_string_views), name);
if (it != std::end(level_string_views))
return static_cast(std::distance(std::begin(level_string_views), it));
// check also for "warn" and "err" before giving up..
- if (name == "warn")
- {
+ if (name == "warn") {
return level::warn;
}
- if (name == "err")
- {
+ if (name == "err") {
return level::err;
}
return level::off;
}
-} // namespace level
+} // namespace level
SPDLOG_INLINE spdlog_ex::spdlog_ex(std::string msg)
- : msg_(std::move(msg))
-{}
+ : msg_(std::move(msg)) {}
-SPDLOG_INLINE spdlog_ex::spdlog_ex(const std::string &msg, int last_errno)
-{
+SPDLOG_INLINE spdlog_ex::spdlog_ex(const std::string &msg, int last_errno) {
#ifdef SPDLOG_USE_STD_FORMAT
msg_ = std::system_error(std::error_code(last_errno, std::generic_category()), msg).what();
#else
@@ -64,19 +57,12 @@ SPDLOG_INLINE spdlog_ex::spdlog_ex(const std::string &msg, int last_errno)
#endif
}
-SPDLOG_INLINE const char *spdlog_ex::what() const SPDLOG_NOEXCEPT
-{
- return msg_.c_str();
-}
+SPDLOG_INLINE const char *spdlog_ex::what() const SPDLOG_NOEXCEPT { return msg_.c_str(); }
-SPDLOG_INLINE void throw_spdlog_ex(const std::string &msg, int last_errno)
-{
+SPDLOG_INLINE void throw_spdlog_ex(const std::string &msg, int last_errno) {
SPDLOG_THROW(spdlog_ex(msg, last_errno));
}
-SPDLOG_INLINE void throw_spdlog_ex(std::string msg)
-{
- SPDLOG_THROW(spdlog_ex(std::move(msg)));
-}
+SPDLOG_INLINE void throw_spdlog_ex(std::string msg) { SPDLOG_THROW(spdlog_ex(std::move(msg))); }
-} // namespace spdlog
+} // namespace spdlog
diff --git a/Tool/spdlog/include/spdlog/common.h b/Tool/spdlog/include/spdlog/common.h
index 0a262eb2..2d73f830 100644
--- a/Tool/spdlog/include/spdlog/common.h
+++ b/Tool/spdlog/include/spdlog/common.h
@@ -3,112 +3,121 @@
#pragma once
-#include
#include
+#include
#include
#include
+#include
+#include
+#include
#include
#include
-#include
#include
#include
-#include
-#include
#ifdef SPDLOG_USE_STD_FORMAT
-# include
-# if __cpp_lib_format >= 202207L
-# include
-# else
-# include
-# endif
+ #include
+ #if __cpp_lib_format >= 202207L
+ #include
+ #else
+ #include
+ #endif
#endif
#ifdef SPDLOG_COMPILED_LIB
-# undef SPDLOG_HEADER_ONLY
-# if defined(SPDLOG_SHARED_LIB)
-# if defined(_WIN32)
-# ifdef spdlog_EXPORTS
-# define SPDLOG_API __declspec(dllexport)
-# else // !spdlog_EXPORTS
-# define SPDLOG_API __declspec(dllimport)
-# endif
-# else // !defined(_WIN32)
-# define SPDLOG_API __attribute__((visibility("default")))
-# endif
-# else // !defined(SPDLOG_SHARED_LIB)
-# define SPDLOG_API
-# endif
-# define SPDLOG_INLINE
-#else // !defined(SPDLOG_COMPILED_LIB)
-# define SPDLOG_API
-# define SPDLOG_HEADER_ONLY
-# define SPDLOG_INLINE inline
-#endif // #ifdef SPDLOG_COMPILED_LIB
+ #undef SPDLOG_HEADER_ONLY
+ #if defined(SPDLOG_SHARED_LIB)
+ #if defined(_WIN32)
+ #ifdef spdlog_EXPORTS
+ #define SPDLOG_API __declspec(dllexport)
+ #else // !spdlog_EXPORTS
+ #define SPDLOG_API __declspec(dllimport)
+ #endif
+ #else // !defined(_WIN32)
+ #define SPDLOG_API __attribute__((visibility("default")))
+ #endif
+ #else // !defined(SPDLOG_SHARED_LIB)
+ #define SPDLOG_API
+ #endif
+ #define SPDLOG_INLINE
+#else // !defined(SPDLOG_COMPILED_LIB)
+ #define SPDLOG_API
+ #define SPDLOG_HEADER_ONLY
+ #define SPDLOG_INLINE inline
+#endif // #ifdef SPDLOG_COMPILED_LIB
#include
-#if !defined(SPDLOG_USE_STD_FORMAT) && FMT_VERSION >= 80000 // backward compatibility with fmt versions older than 8
-# define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string)
-# define SPDLOG_FMT_STRING(format_string) FMT_STRING(format_string)
-# if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
-# include
-# endif
+#if !defined(SPDLOG_USE_STD_FORMAT) && \
+ FMT_VERSION >= 80000 // backward compatibility with fmt versions older than 8
+ #define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string)
+ #define SPDLOG_FMT_STRING(format_string) FMT_STRING(format_string)
+ #if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
+ #include
+ #endif
#else
-# define SPDLOG_FMT_RUNTIME(format_string) format_string
-# define SPDLOG_FMT_STRING(format_string) format_string
+ #define SPDLOG_FMT_RUNTIME(format_string) format_string
+ #define SPDLOG_FMT_STRING(format_string) format_string
#endif
// visual studio up to 2013 does not support noexcept nor constexpr
#if defined(_MSC_VER) && (_MSC_VER < 1900)
-# define SPDLOG_NOEXCEPT _NOEXCEPT
-# define SPDLOG_CONSTEXPR
-# define SPDLOG_CONSTEXPR_FUNC inline
+ #define SPDLOG_NOEXCEPT _NOEXCEPT
+ #define SPDLOG_CONSTEXPR
#else
-# define SPDLOG_NOEXCEPT noexcept
-# define SPDLOG_CONSTEXPR constexpr
-# if __cplusplus >= 201402L
-# define SPDLOG_CONSTEXPR_FUNC constexpr
-# else
-# define SPDLOG_CONSTEXPR_FUNC inline
-# endif
+ #define SPDLOG_NOEXCEPT noexcept
+ #define SPDLOG_CONSTEXPR constexpr
+#endif
+
+// If building with std::format, can just use constexpr, otherwise if building with fmt
+// SPDLOG_CONSTEXPR_FUNC needs to be set the same as FMT_CONSTEXPR to avoid situations where
+// a constexpr function in spdlog could end up calling a non-constexpr function in fmt
+// depending on the compiler
+// If fmt determines it can't use constexpr, we should inline the function instead
+#ifdef SPDLOG_USE_STD_FORMAT
+ #define SPDLOG_CONSTEXPR_FUNC constexpr
+#else // Being built with fmt
+ #if FMT_USE_CONSTEXPR
+ #define SPDLOG_CONSTEXPR_FUNC FMT_CONSTEXPR
+ #else
+ #define SPDLOG_CONSTEXPR_FUNC inline
+ #endif
#endif
#if defined(__GNUC__) || defined(__clang__)
-# define SPDLOG_DEPRECATED __attribute__((deprecated))
+ #define SPDLOG_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
-# define SPDLOG_DEPRECATED __declspec(deprecated)
+ #define SPDLOG_DEPRECATED __declspec(deprecated)
#else
-# define SPDLOG_DEPRECATED
+ #define SPDLOG_DEPRECATED
#endif
// disable thread local on msvc 2013
#ifndef SPDLOG_NO_TLS
-# if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt)
-# define SPDLOG_NO_TLS 1
-# endif
+ #if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt)
+ #define SPDLOG_NO_TLS 1
+ #endif
#endif
#ifndef SPDLOG_FUNCTION
-# define SPDLOG_FUNCTION static_cast(__FUNCTION__)
+ #define SPDLOG_FUNCTION static_cast(__FUNCTION__)
#endif
#ifdef SPDLOG_NO_EXCEPTIONS
-# define SPDLOG_TRY
-# define SPDLOG_THROW(ex) \
- do \
- { \
- printf("spdlog fatal error: %s\n", ex.what()); \
- std::abort(); \
+ #define SPDLOG_TRY
+ #define SPDLOG_THROW(ex) \
+ do { \
+ printf("spdlog fatal error: %s\n", ex.what()); \
+ std::abort(); \
} while (0)
-# define SPDLOG_CATCH_STD
+ #define SPDLOG_CATCH_STD
#else
-# define SPDLOG_TRY try
-# define SPDLOG_THROW(ex) throw(ex)
-# define SPDLOG_CATCH_STD \
- catch (const std::exception &) \
- {}
+ #define SPDLOG_TRY try
+ #define SPDLOG_THROW(ex) throw(ex)
+ #define SPDLOG_CATCH_STD \
+ catch (const std::exception &) { \
+ }
#endif
namespace spdlog {
@@ -121,12 +130,12 @@ class sink;
#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
using filename_t = std::wstring;
-// allow macro expansion to occur in SPDLOG_FILENAME_T
-# define SPDLOG_FILENAME_T_INNER(s) L##s
-# define SPDLOG_FILENAME_T(s) SPDLOG_FILENAME_T_INNER(s)
+ // allow macro expansion to occur in SPDLOG_FILENAME_T
+ #define SPDLOG_FILENAME_T_INNER(s) L##s
+ #define SPDLOG_FILENAME_T(s) SPDLOG_FILENAME_T_INNER(s)
#else
using filename_t = std::string;
-# define SPDLOG_FILENAME_T(s) s
+ #define SPDLOG_FILENAME_T(s) s
#endif
using log_clock = std::chrono::system_clock;
@@ -139,76 +148,79 @@ namespace fmt_lib = std;
using string_view_t = std::string_view;
using memory_buf_t = std::string;
-template
-# if __cpp_lib_format >= 202207L
+template
+ #if __cpp_lib_format >= 202207L
using format_string_t = std::format_string;
-# else
+ #else
using format_string_t = std::string_view;
-# endif
+ #endif
-template
-struct is_convertible_to_basic_format_string : std::integral_constant>::value>
-{};
+template
+struct is_convertible_to_basic_format_string
+ : std::integral_constant>::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 wmemory_buf_t = std::wstring;
-template
-# if __cpp_lib_format >= 202207L
+template
+ #if __cpp_lib_format >= 202207L
using wformat_string_t = std::wformat_string;
-# else
+ #else
using wformat_string_t = std::wstring_view;
-# endif
-# endif
-# define SPDLOG_BUF_TO_STRING(x) x
-#else // use fmt lib instead of std::format
+ #endif
+ #endif
+ #define SPDLOG_BUF_TO_STRING(x) x
+#else // use fmt lib instead of std::format
namespace fmt_lib = fmt;
using string_view_t = fmt::basic_string_view;
using memory_buf_t = fmt::basic_memory_buffer;
-template
+template
using format_string_t = fmt::format_string;
-template
+template
using remove_cvref_t = typename std::remove_cv::type>::type;
-template
-# if FMT_VERSION >= 90101
+template
+ #if FMT_VERSION >= 90101
using fmt_runtime_string = fmt::runtime_format_string;
-# else
+ #else
using fmt_runtime_string = fmt::basic_runtime;
-# endif
+ #endif
-// 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 is only convertible to basic_format_string but not basic_string_view
-template
+// 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 is only
+// convertible to basic_format_string but not basic_string_view
+template
struct is_convertible_to_basic_format_string
: std::integral_constant>::value || std::is_same, fmt_runtime_string>::value>
-{};
+ std::is_convertible>::value ||
+ std::is_same, fmt_runtime_string>::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;
using wmemory_buf_t = fmt::basic_memory_buffer;
-template
+template
using wformat_string_t = fmt::wformat_string;
-# endif
-# define SPDLOG_BUF_TO_STRING(x) fmt::to_string(x)
+ #endif
+ #define SPDLOG_BUF_TO_STRING(x) fmt::to_string(x)
#endif
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
-# ifndef _WIN32
-# error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows
-# endif // _WIN32
-#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
+ #ifndef _WIN32
+ #error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows
+ #endif // _WIN32
+#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
-template
-struct is_convertible_to_any_format_string : std::integral_constant::value ||
- is_convertible_to_basic_format_string::value>
-{};
+template
+struct is_convertible_to_any_format_string
+ : std::integral_constant::value ||
+ is_convertible_to_basic_format_string::value> {};
#if defined(SPDLOG_NO_ATOMIC_LEVELS)
using level_t = details::null_atomic_int;
@@ -225,13 +237,12 @@ using level_t = std::atomic;
#define SPDLOG_LEVEL_OFF 6
#if !defined(SPDLOG_ACTIVE_LEVEL)
-# define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO
+ #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO
#endif
// Log level enum
namespace level {
-enum level_enum : int
-{
+enum level_enum : int {
trace = SPDLOG_LEVEL_TRACE,
debug = SPDLOG_LEVEL_DEBUG,
info = SPDLOG_LEVEL_INFO,
@@ -251,52 +262,44 @@ enum level_enum : int
#define SPDLOG_LEVEL_NAME_OFF spdlog::string_view_t("off", 3)
#if !defined(SPDLOG_LEVEL_NAMES)
-# define SPDLOG_LEVEL_NAMES \
- { \
- SPDLOG_LEVEL_NAME_TRACE, SPDLOG_LEVEL_NAME_DEBUG, SPDLOG_LEVEL_NAME_INFO, SPDLOG_LEVEL_NAME_WARNING, SPDLOG_LEVEL_NAME_ERROR, \
- SPDLOG_LEVEL_NAME_CRITICAL, SPDLOG_LEVEL_NAME_OFF \
+ #define SPDLOG_LEVEL_NAMES \
+ { \
+ SPDLOG_LEVEL_NAME_TRACE, SPDLOG_LEVEL_NAME_DEBUG, SPDLOG_LEVEL_NAME_INFO, \
+ SPDLOG_LEVEL_NAME_WARNING, SPDLOG_LEVEL_NAME_ERROR, SPDLOG_LEVEL_NAME_CRITICAL, \
+ SPDLOG_LEVEL_NAME_OFF \
}
#endif
#if !defined(SPDLOG_SHORT_LEVEL_NAMES)
-# define SPDLOG_SHORT_LEVEL_NAMES \
- { \
- "T", "D", "I", "W", "E", "C", "O" \
- }
+ #define SPDLOG_SHORT_LEVEL_NAMES \
+ { "T", "D", "I", "W", "E", "C", "O" }
#endif
SPDLOG_API const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
SPDLOG_API const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
SPDLOG_API spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT;
-} // namespace level
+} // namespace level
//
// Color mode used by sinks with color support.
//
-enum class color_mode
-{
- always,
- automatic,
- never
-};
+enum class color_mode { always, automatic, never };
//
// Pattern time - specific time getting to use for pattern_formatter.
// local time by default
//
-enum class pattern_time_type
-{
- local, // log localtime
- utc // log utc
+enum class pattern_time_type {
+ local, // log localtime
+ utc // log utc
};
//
// Log exception
//
-class SPDLOG_API spdlog_ex : public std::exception
-{
+class SPDLOG_API spdlog_ex : public std::exception {
public:
explicit spdlog_ex(std::string msg);
spdlog_ex(const std::string &msg, int last_errno);
@@ -309,32 +312,25 @@ private:
[[noreturn]] SPDLOG_API void throw_spdlog_ex(const std::string &msg, int last_errno);
[[noreturn]] SPDLOG_API void throw_spdlog_ex(std::string msg);
-struct source_loc
-{
+struct source_loc {
SPDLOG_CONSTEXPR source_loc() = default;
SPDLOG_CONSTEXPR source_loc(const char *filename_in, int line_in, const char *funcname_in)
- : filename{filename_in}
- , line{line_in}
- , funcname{funcname_in}
- {}
+ : filename{filename_in},
+ line{line_in},
+ funcname{funcname_in} {}
- SPDLOG_CONSTEXPR bool empty() const SPDLOG_NOEXCEPT
- {
- return line == 0;
- }
+ SPDLOG_CONSTEXPR bool empty() const SPDLOG_NOEXCEPT { return line <= 0; }
const char *filename{nullptr};
int line{0};
const char *funcname{nullptr};
};
-struct file_event_handlers
-{
+struct file_event_handlers {
file_event_handlers()
- : before_open(nullptr)
- , after_open(nullptr)
- , before_close(nullptr)
- , after_close(nullptr)
- {}
+ : before_open(nullptr),
+ after_open(nullptr),
+ before_close(nullptr),
+ after_close(nullptr) {}
std::function before_open;
std::function after_open;
@@ -346,75 +342,77 @@ namespace details {
// to_string_view
-SPDLOG_CONSTEXPR_FUNC spdlog::string_view_t to_string_view(const memory_buf_t &buf) SPDLOG_NOEXCEPT
-{
+SPDLOG_CONSTEXPR_FUNC spdlog::string_view_t to_string_view(const memory_buf_t &buf)
+ SPDLOG_NOEXCEPT {
return spdlog::string_view_t{buf.data(), buf.size()};
}
-SPDLOG_CONSTEXPR_FUNC spdlog::string_view_t to_string_view(spdlog::string_view_t str) SPDLOG_NOEXCEPT
-{
+SPDLOG_CONSTEXPR_FUNC spdlog::string_view_t to_string_view(spdlog::string_view_t str)
+ SPDLOG_NOEXCEPT {
return str;
}
#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
-SPDLOG_CONSTEXPR_FUNC spdlog::wstring_view_t to_string_view(const wmemory_buf_t &buf) SPDLOG_NOEXCEPT
-{
+SPDLOG_CONSTEXPR_FUNC spdlog::wstring_view_t to_string_view(const wmemory_buf_t &buf)
+ SPDLOG_NOEXCEPT {
return spdlog::wstring_view_t{buf.data(), buf.size()};
}
-SPDLOG_CONSTEXPR_FUNC spdlog::wstring_view_t to_string_view(spdlog::wstring_view_t str) SPDLOG_NOEXCEPT
-{
+SPDLOG_CONSTEXPR_FUNC spdlog::wstring_view_t to_string_view(spdlog::wstring_view_t str)
+ SPDLOG_NOEXCEPT {
return str;
}
#endif
#ifndef SPDLOG_USE_STD_FORMAT
-template
-inline fmt::basic_string_view to_string_view(fmt::basic_format_string fmt)
-{
+#if FMT_VERSION >= 110100
+template
+inline fmt::basic_string_view to_string_view(fmt::basic_format_arg fmt) {
return fmt;
}
+#else
+template
+inline fmt::basic_string_view to_string_view(fmt::basic_format_string fmt) {
+ return fmt;
+}
+#endif
#elif __cpp_lib_format >= 202207L
-template
-SPDLOG_CONSTEXPR_FUNC std::basic_string_view to_string_view(std::basic_format_string fmt) SPDLOG_NOEXCEPT
-{
+template
+SPDLOG_CONSTEXPR_FUNC std::basic_string_view to_string_view(
+ std::basic_format_string fmt) SPDLOG_NOEXCEPT {
return fmt.get();
}
#endif
// make_unique support for pre c++14
-
-#if __cplusplus >= 201402L // C++14 and beyond
+#if __cplusplus >= 201402L // C++14 and beyond
using std::enable_if_t;
using std::make_unique;
#else
-template
+template
using enable_if_t = typename std::enable_if::type;
-template
-std::unique_ptr make_unique(Args &&...args)
-{
+template
+std::unique_ptr make_unique(Args &&...args) {
static_assert(!std::is_array::value, "arrays not supported");
return std::unique_ptr(new T(std::forward(args)...));
}
#endif
// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324)
-template::value, int> = 0>
-constexpr T conditional_static_cast(U value)
-{
+template ::value, int> = 0>
+constexpr T conditional_static_cast(U value) {
return static_cast(value);
}
-template::value, int> = 0>
-constexpr T conditional_static_cast(U value)
-{
+template ::value, int> = 0>
+constexpr T conditional_static_cast(U value) {
return value;
}
-} // namespace details
-} // namespace spdlog
+} // namespace details
+} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
-# include "common-inl.h"
+ #include "common-inl.h"
#endif
diff --git a/Tool/spdlog/include/spdlog/details/backtracer-inl.h b/Tool/spdlog/include/spdlog/details/backtracer-inl.h
index 40eba408..43d10024 100644
--- a/Tool/spdlog/include/spdlog/details/backtracer-inl.h
+++ b/Tool/spdlog/include/spdlog/details/backtracer-inl.h
@@ -4,72 +4,60 @@
#pragma once
#ifndef SPDLOG_HEADER_ONLY
-# include
+ #include
#endif
namespace spdlog {
namespace details {
-SPDLOG_INLINE backtracer::backtracer(const backtracer &other)
-{
+SPDLOG_INLINE backtracer::backtracer(const backtracer &other) {
std::lock_guard lock(other.mutex_);
enabled_ = other.enabled();
messages_ = other.messages_;
}
-SPDLOG_INLINE backtracer::backtracer(backtracer &&other) SPDLOG_NOEXCEPT
-{
+SPDLOG_INLINE backtracer::backtracer(backtracer &&other) SPDLOG_NOEXCEPT {
std::lock_guard lock(other.mutex_);
enabled_ = other.enabled();
messages_ = std::move(other.messages_);
}
-SPDLOG_INLINE backtracer &backtracer::operator=(backtracer other)
-{
+SPDLOG_INLINE backtracer &backtracer::operator=(backtracer other) {
std::lock_guard lock(mutex_);
enabled_ = other.enabled();
messages_ = std::move(other.messages_);
return *this;
}
-SPDLOG_INLINE void backtracer::enable(size_t size)
-{
+SPDLOG_INLINE void backtracer::enable(size_t size) {
std::lock_guard lock{mutex_};
enabled_.store(true, std::memory_order_relaxed);
messages_ = circular_q{size};
}
-SPDLOG_INLINE void backtracer::disable()
-{
+SPDLOG_INLINE void backtracer::disable() {
std::lock_guard lock{mutex_};
enabled_.store(false, std::memory_order_relaxed);
}
-SPDLOG_INLINE bool backtracer::enabled() const
-{
- return enabled_.load(std::memory_order_relaxed);
-}
+SPDLOG_INLINE bool backtracer::enabled() const { return enabled_.load(std::memory_order_relaxed); }
-SPDLOG_INLINE void backtracer::push_back(const log_msg &msg)
-{
+SPDLOG_INLINE void backtracer::push_back(const log_msg &msg) {
std::lock_guard lock{mutex_};
messages_.push_back(log_msg_buffer{msg});
}
-SPDLOG_INLINE bool backtracer::empty() const
-{
+SPDLOG_INLINE bool backtracer::empty() const {
std::lock_guard lock{mutex_};
return messages_.empty();
}
// pop all items in the q and apply the given fun on each of them.
-SPDLOG_INLINE void backtracer::foreach_pop(std::function fun)
-{
+SPDLOG_INLINE void backtracer::foreach_pop(std::function fun) {
std::lock_guard lock{mutex_};
- while (!messages_.empty())
- {
+ while (!messages_.empty()) {
auto &front_msg = messages_.front();
fun(front_msg);
messages_.pop_front();
}
}
-} // namespace details
-} // namespace spdlog
+} // namespace details
+} // namespace spdlog
diff --git a/Tool/spdlog/include/spdlog/details/backtracer.h b/Tool/spdlog/include/spdlog/details/backtracer.h
index 13785d85..541339cd 100644
--- a/Tool/spdlog/include/spdlog/details/backtracer.h
+++ b/Tool/spdlog/include/spdlog/details/backtracer.h
@@ -3,20 +3,19 @@
#pragma once
-#include
#include
+#include
#include
-#include
#include
+#include
// Store log messages in circular buffer.
// Useful for storing debug data in case of error/warning happens.
namespace spdlog {
namespace details {
-class SPDLOG_API backtracer
-{
+class SPDLOG_API backtracer {
mutable std::mutex mutex_;
std::atomic enabled_{false};
circular_q messages_;
@@ -38,9 +37,9 @@ public:
void foreach_pop(std::function fun);
};
-} // namespace details
-} // namespace spdlog
+} // namespace details
+} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
-# include "backtracer-inl.h"
+ #include "backtracer-inl.h"
#endif
diff --git a/Tool/spdlog/include/spdlog/details/circular_q.h b/Tool/spdlog/include/spdlog/details/circular_q.h
index e4fd5fd4..29e9d255 100644
--- a/Tool/spdlog/include/spdlog/details/circular_q.h
+++ b/Tool/spdlog/include/spdlog/details/circular_q.h
@@ -4,14 +4,15 @@
// circular q view of std::vector.
#pragma once
-#include
#include
+#include
+
+#include "spdlog/common.h"
namespace spdlog {
namespace details {
-template
-class circular_q
-{
+template
+class circular_q {
size_t max_items_ = 0;
typename std::vector::size_type head_ = 0;
typename std::vector::size_type tail_ = 0;
@@ -25,35 +26,29 @@ public:
circular_q() = default;
explicit circular_q(size_t max_items)
- : max_items_(max_items + 1) // one item is reserved as marker for full q
- , v_(max_items_)
- {}
+ : max_items_(max_items + 1) // one item is reserved as marker for full q
+ ,
+ v_(max_items_) {}
circular_q(const circular_q &) = default;
circular_q &operator=(const circular_q &) = default;
// move cannot be default,
// since we need to reset head_, tail_, etc to zero in the moved object
- circular_q(circular_q &&other) SPDLOG_NOEXCEPT
- {
- copy_moveable(std::move(other));
- }
+ circular_q(circular_q &&other) SPDLOG_NOEXCEPT { copy_moveable(std::move(other)); }
- circular_q &operator=(circular_q &&other) SPDLOG_NOEXCEPT
- {
+ circular_q &operator=(circular_q &&other) SPDLOG_NOEXCEPT {
copy_moveable(std::move(other));
return *this;
}
// push back, overrun (oldest) item if no room left
- void push_back(T &&item)
- {
- if (max_items_ > 0)
- {
+ void push_back(T &&item) {
+ if (max_items_ > 0) {
v_[tail_] = std::move(item);
tail_ = (tail_ + 1) % max_items_;
- if (tail_ == head_) // overrun last item if full
+ if (tail_ == head_) // overrun last item if full
{
head_ = (head_ + 1) % max_items_;
++overrun_counter_;
@@ -63,73 +58,47 @@ public:
// Return reference to the front item.
// If there are no elements in the container, the behavior is undefined.
- const T &front() const
- {
- return v_[head_];
- }
+ const T &front() const { return v_[head_]; }
- T &front()
- {
- return v_[head_];
- }
+ T &front() { return v_[head_]; }
// Return number of elements actually stored
- size_t size() const
- {
- if (tail_ >= head_)
- {
+ size_t size() const {
+ if (tail_ >= head_) {
return tail_ - head_;
- }
- else
- {
+ } else {
return max_items_ - (head_ - tail_);
}
}
// Return const reference to item by index.
// If index is out of range 0…size()-1, the behavior is undefined.
- const T &at(size_t i) const
- {
+ const T &at(size_t i) const {
assert(i < size());
return v_[(head_ + i) % max_items_];
}
// Pop item from front.
// If there are no elements in the container, the behavior is undefined.
- void pop_front()
- {
- head_ = (head_ + 1) % max_items_;
- }
+ void pop_front() { head_ = (head_ + 1) % max_items_; }
- bool empty() const
- {
- return tail_ == head_;
- }
+ bool empty() const { return tail_ == head_; }
- bool full() const
- {
+ bool full() const {
// head is ahead of the tail by 1
- if (max_items_ > 0)
- {
+ if (max_items_ > 0) {
return ((tail_ + 1) % max_items_) == head_;
}
return false;
}
- size_t overrun_counter() const
- {
- return overrun_counter_;
- }
+ size_t overrun_counter() const { return overrun_counter_; }
- void reset_overrun_counter()
- {
- overrun_counter_ = 0;
- }
+ void reset_overrun_counter() { overrun_counter_ = 0; }
private:
// copy from other&& and reset it to disabled state
- void copy_moveable(circular_q &&other) SPDLOG_NOEXCEPT
- {
+ void copy_moveable(circular_q &&other) SPDLOG_NOEXCEPT {
max_items_ = other.max_items_;
head_ = other.head_;
tail_ = other.tail_;
@@ -142,5 +111,5 @@ private:
other.overrun_counter_ = 0;
}
};
-} // namespace details
-} // namespace spdlog
+} // namespace details
+} // namespace spdlog
diff --git a/Tool/spdlog/include/spdlog/details/console_globals.h b/Tool/spdlog/include/spdlog/details/console_globals.h
index 665201dd..9c552106 100644
--- a/Tool/spdlog/include/spdlog/details/console_globals.h
+++ b/Tool/spdlog/include/spdlog/details/console_globals.h
@@ -3,30 +3,26 @@
#pragma once
-#include
#include
+#include
namespace spdlog {
namespace details {
-struct console_mutex
-{
+struct console_mutex {
using mutex_t = std::mutex;
- static mutex_t &mutex()
- {
+ static mutex_t &mutex() {
static mutex_t s_mutex;
return s_mutex;
}
};
-struct console_nullmutex
-{
+struct console_nullmutex {
using mutex_t = null_mutex;
- static mutex_t &mutex()
- {
+ static mutex_t &mutex() {
static mutex_t s_mutex;
return s_mutex;
}
};
-} // namespace details
-} // namespace spdlog
+} // namespace details
+} // namespace spdlog
diff --git a/Tool/spdlog/include/spdlog/details/file_helper-inl.h b/Tool/spdlog/include/spdlog/details/file_helper-inl.h
index 74c89a87..8742b96c 100644
--- a/Tool/spdlog/include/spdlog/details/file_helper-inl.h
+++ b/Tool/spdlog/include/spdlog/details/file_helper-inl.h
@@ -4,11 +4,11 @@
#pragma once
#ifndef SPDLOG_HEADER_ONLY
-# include
+ #include
#endif
-#include
#include
+#include
#include
#include
@@ -21,47 +21,36 @@ namespace spdlog {
namespace details {
SPDLOG_INLINE file_helper::file_helper(const file_event_handlers &event_handlers)
- : event_handlers_(event_handlers)
-{}
+ : event_handlers_(event_handlers) {}
-SPDLOG_INLINE file_helper::~file_helper()
-{
- close();
-}
+SPDLOG_INLINE file_helper::~file_helper() { close(); }
-SPDLOG_INLINE void file_helper::open(const filename_t &fname, bool truncate)
-{
+SPDLOG_INLINE void file_helper::open(const filename_t &fname, bool truncate) {
close();
filename_ = fname;
auto *mode = SPDLOG_FILENAME_T("ab");
auto *trunc_mode = SPDLOG_FILENAME_T("wb");
- if (event_handlers_.before_open)
- {
+ if (event_handlers_.before_open) {
event_handlers_.before_open(filename_);
}
- for (int tries = 0; tries < open_tries_; ++tries)
- {
+ for (int tries = 0; tries < open_tries_; ++tries) {
// create containing folder if not exists already.
os::create_dir(os::dir_name(fname));
- if (truncate)
- {
+ if (truncate) {
// Truncate by opening-and-closing a tmp file in "wb" mode, always
// opening the actual log-we-write-to in "ab" mode, since that
// interacts more politely with eternal processes that might
// rotate/truncate the file underneath us.
std::FILE *tmp;
- if (os::fopen_s(&tmp, fname, trunc_mode))
- {
+ if (os::fopen_s(&tmp, fname, trunc_mode)) {
continue;
}
std::fclose(tmp);
}
- if (!os::fopen_s(&fd_, fname, mode))
- {
- if (event_handlers_.after_open)
- {
+ if (!os::fopen_s(&fd_, fname, mode)) {
+ if (event_handlers_.after_open) {
event_handlers_.after_open(filename_, fd_);
}
return;
@@ -70,76 +59,62 @@ SPDLOG_INLINE void file_helper::open(const filename_t &fname, bool truncate)
details::os::sleep_for_millis(open_interval_);
}
- throw_spdlog_ex("Failed opening file " + os::filename_to_str(filename_) + " for writing", errno);
+ throw_spdlog_ex("Failed opening file " + os::filename_to_str(filename_) + " for writing",
+ errno);
}
-SPDLOG_INLINE void file_helper::reopen(bool truncate)
-{
- if (filename_.empty())
- {
+SPDLOG_INLINE void file_helper::reopen(bool truncate) {
+ if (filename_.empty()) {
throw_spdlog_ex("Failed re opening file - was not opened before");
}
this->open(filename_, truncate);
}
-SPDLOG_INLINE void file_helper::flush()
-{
- if (std::fflush(fd_) != 0)
- {
+SPDLOG_INLINE void file_helper::flush() {
+ if (std::fflush(fd_) != 0) {
throw_spdlog_ex("Failed flush to file " + os::filename_to_str(filename_), errno);
}
}
-SPDLOG_INLINE void file_helper::sync()
-{
- if (!os::fsync(fd_))
- {
+SPDLOG_INLINE void file_helper::sync() {
+ if (!os::fsync(fd_)) {
throw_spdlog_ex("Failed to fsync file " + os::filename_to_str(filename_), errno);
}
}
-SPDLOG_INLINE void file_helper::close()
-{
- if (fd_ != nullptr)
- {
- if (event_handlers_.before_close)
- {
+SPDLOG_INLINE void file_helper::close() {
+ if (fd_ != nullptr) {
+ if (event_handlers_.before_close) {
event_handlers_.before_close(filename_, fd_);
}
std::fclose(fd_);
fd_ = nullptr;
- if (event_handlers_.after_close)
- {
+ if (event_handlers_.after_close) {
event_handlers_.after_close(filename_);
}
}
}
-SPDLOG_INLINE void file_helper::write(const memory_buf_t &buf)
-{
+SPDLOG_INLINE void file_helper::write(const memory_buf_t &buf) {
+ if (fd_ == nullptr) return;
size_t msg_size = buf.size();
auto data = buf.data();
- if (std::fwrite(data, 1, msg_size, fd_) != msg_size)
- {
+
+ if (!details::os::fwrite_bytes(data, msg_size, fd_)) {
throw_spdlog_ex("Failed writing to file " + os::filename_to_str(filename_), errno);
}
}
-SPDLOG_INLINE size_t file_helper::size() const
-{
- if (fd_ == nullptr)
- {
+SPDLOG_INLINE size_t file_helper::size() const {
+ if (fd_ == nullptr) {
throw_spdlog_ex("Cannot use size() on closed file " + os::filename_to_str(filename_));
}
return os::filesize(fd_);
}
-SPDLOG_INLINE const filename_t &file_helper::filename() const
-{
- return filename_;
-}
+SPDLOG_INLINE const filename_t &file_helper::filename() const { return filename_; }
//
// return file path and its extension:
@@ -154,21 +129,19 @@ SPDLOG_INLINE const filename_t &file_helper::filename() const
// ".mylog" => (".mylog". "")
// "my_folder/.mylog" => ("my_folder/.mylog", "")
// "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt")
-SPDLOG_INLINE std::tuple file_helper::split_by_extension(const filename_t &fname)
-{
+SPDLOG_INLINE std::tuple file_helper::split_by_extension(
+ const filename_t &fname) {
auto ext_index = fname.rfind('.');
// no valid extension found - return whole path and empty string as
// extension
- if (ext_index == filename_t::npos || ext_index == 0 || ext_index == fname.size() - 1)
- {
+ if (ext_index == filename_t::npos || ext_index == 0 || ext_index == fname.size() - 1) {
return std::make_tuple(fname, filename_t());
}
// treat cases like "/etc/rc.d/somelogfile or "/abc/.hiddenfile"
auto folder_index = fname.find_last_of(details::os::folder_seps_filename);
- if (folder_index != filename_t::npos && folder_index >= ext_index - 1)
- {
+ if (folder_index != filename_t::npos && folder_index >= ext_index - 1) {
return std::make_tuple(fname, filename_t());
}
@@ -176,5 +149,5 @@ SPDLOG_INLINE std::tuple file_helper::split_by_extension
return std::make_tuple(fname.substr(0, ext_index), fname.substr(ext_index));
}
-} // namespace details
-} // namespace spdlog
+} // namespace details
+} // namespace spdlog
diff --git a/Tool/spdlog/include/spdlog/details/file_helper.h b/Tool/spdlog/include/spdlog/details/file_helper.h
index f42a5eb1..f0e5d180 100644
--- a/Tool/spdlog/include/spdlog/details/file_helper.h
+++ b/Tool/spdlog/include/spdlog/details/file_helper.h
@@ -13,8 +13,7 @@ namespace details {
// When failing to open a file, retry several times(5) with a delay interval(10 ms).
// Throw spdlog_ex exception on errors.
-class SPDLOG_API file_helper
-{
+class SPDLOG_API file_helper {
public:
file_helper() = default;
explicit file_helper(const file_event_handlers &event_handlers);
@@ -54,9 +53,9 @@ private:
filename_t filename_;
file_event_handlers event_handlers_;
};
-} // namespace details
-} // namespace spdlog
+} // namespace details
+} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
-# include "file_helper-inl.h"
+ #include "file_helper-inl.h"
#endif
diff --git a/Tool/spdlog/include/spdlog/details/fmt_helper.h b/Tool/spdlog/include/spdlog/details/fmt_helper.h
index d9867180..61306003 100644
--- a/Tool/spdlog/include/spdlog/details/fmt_helper.h
+++ b/Tool/spdlog/include/spdlog/details/fmt_helper.h
@@ -3,14 +3,14 @@
#pragma once
#include
-#include
#include
-#include
#include