update spdlog (it still dont work), fix 6.3(1)

This commit is contained in:
Gray
2024-06-10 16:30:29 -04:00
parent dd2bbfacda
commit bab7c30669
107 changed files with 10351 additions and 9620 deletions

View File

@@ -9,23 +9,22 @@
// This class is thread safe
#include <spdlog/common.h>
#include <spdlog/details/periodic_worker.h>
#include <chrono>
#include <functional>
#include <memory>
#include <mutex>
#include <string>
#include <unordered_map>
#include <mutex>
namespace spdlog {
class logger;
namespace details {
class thread_pool;
class periodic_worker;
class SPDLOG_API registry
{
class SPDLOG_API registry {
public:
using log_levels = std::unordered_map<std::string, level::level_enum>;
registry(const registry &) = delete;
@@ -39,11 +38,14 @@ public:
// Return raw ptr to the default logger.
// To be used directly by the spdlog default api (e.g. spdlog::info)
// This make the default API faster, but cannot be used concurrently with set_default_logger().
// e.g do not call set_default_logger() from one thread while calling spdlog::info() from another.
// e.g do not call set_default_logger() from one thread while calling spdlog::info() from
// another.
logger *get_default_raw();
// set default logger.
// set default logger and add it to the registry if not registered already.
// default logger is stored in default_logger_ (for faster retrieval) and in the loggers_ map.
// Note: Make sure to unregister it when no longer needed or before calling again with a new
// logger.
void set_default_logger(std::shared_ptr<logger> new_default_logger);
void set_tp(std::shared_ptr<thread_pool> tp);
@@ -61,7 +63,17 @@ public:
void flush_on(level::level_enum log_level);
void flush_every(std::chrono::seconds interval);
template <typename Rep, typename Period>
void flush_every(std::chrono::duration<Rep, Period> interval) {
std::lock_guard<std::mutex> lock(flusher_mutex_);
auto clbk = [this]() { this->flush_all(); };
periodic_flusher_ = details::make_unique<periodic_worker>(clbk, interval);
}
std::unique_ptr<periodic_worker> &get_flusher() {
std::lock_guard<std::mutex> lock(flusher_mutex_);
return periodic_flusher_;
}
void set_error_handler(err_handler handler);
@@ -85,6 +97,8 @@ public:
static registry &instance();
void apply_logger_env_levels(std::shared_ptr<logger> new_logger);
private:
registry();
~registry();
@@ -107,9 +121,9 @@ private:
size_t backtrace_n_messages_ = 0;
};
} // namespace details
} // namespace spdlog
} // namespace details
} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
# include "registry-inl.h"
#include "registry-inl.h"
#endif