mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 02:19:35 +08:00
clang-format
This commit is contained in:
@@ -80,8 +80,7 @@ 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.
|
||||
|
@@ -69,7 +69,10 @@ public:
|
||||
periodic_flusher_ = std::make_unique<periodic_worker>(clbk, interval);
|
||||
}
|
||||
|
||||
std::unique_ptr<periodic_worker> &get_flusher() { std::lock_guard<std::mutex> lock(flusher_mutex_); return periodic_flusher_; }
|
||||
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);
|
||||
|
||||
|
@@ -1,36 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <spdlog/common.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include <spdlog/common.h>
|
||||
|
||||
namespace spdlog {
|
||||
class SPDLOG_API mdc {
|
||||
public:
|
||||
using mdc_map_t = std::map<std::string, std::string>;
|
||||
class SPDLOG_API mdc {
|
||||
public:
|
||||
using mdc_map_t = std::map<std::string, std::string>;
|
||||
|
||||
static void put(const std::string &key, const std::string &value) {
|
||||
get_context()[key] = value;
|
||||
static void put(const std::string &key, const std::string &value) { get_context()[key] = value; }
|
||||
|
||||
static std::string get(const std::string &key) {
|
||||
auto &context = get_context();
|
||||
auto it = context.find(key);
|
||||
if (it != context.end()) {
|
||||
return it->second;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static std::string get(const std::string &key) {
|
||||
auto &context = get_context();
|
||||
auto it = context.find(key);
|
||||
if (it != context.end()) {
|
||||
return it->second;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
static void remove(const std::string &key) { get_context().erase(key); }
|
||||
|
||||
static void remove(const std::string &key) { get_context().erase(key); }
|
||||
static void clear() { get_context().clear(); }
|
||||
|
||||
static void clear() { get_context().clear(); }
|
||||
|
||||
static mdc_map_t &get_context() {
|
||||
static thread_local mdc_map_t context;
|
||||
return context;
|
||||
}
|
||||
};
|
||||
static mdc_map_t &get_context() {
|
||||
static thread_local mdc_map_t context;
|
||||
return context;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace spdlog
|
||||
|
@@ -27,7 +27,7 @@ public:
|
||||
|
||||
protected:
|
||||
void sink_it_(const details::log_msg &msg) override { callback_(msg); }
|
||||
void flush_() override{};
|
||||
void flush_() override {};
|
||||
|
||||
private:
|
||||
custom_log_callback callback_;
|
||||
|
@@ -170,8 +170,7 @@ protected:
|
||||
color_range_start, // color range start
|
||||
color_range_end}; // color range end
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
qt_text_edit_, [params]() { invoke_method_(params); }, Qt::AutoConnection);
|
||||
QMetaObject::invokeMethod(qt_text_edit_, [params]() { invoke_method_(params); }, Qt::AutoConnection);
|
||||
}
|
||||
|
||||
void flush_() override {}
|
||||
|
@@ -37,7 +37,9 @@ public:
|
||||
: start_tp_{clock::now()} {}
|
||||
|
||||
[[nodiscard]]
|
||||
std::chrono::duration<double> elapsed() const { return std::chrono::duration<double>(clock::now() - start_tp_); }
|
||||
std::chrono::duration<double> elapsed() const {
|
||||
return std::chrono::duration<double>(clock::now() - start_tp_);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
std::chrono::milliseconds elapsed_ms() const {
|
||||
|
Reference in New Issue
Block a user