clang-format

This commit is contained in:
gabime
2024-05-03 18:30:46 +03:00
parent 15829cfb84
commit 06be4409e6
14 changed files with 273 additions and 290 deletions

View File

@@ -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.

View File

@@ -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);

View File

@@ -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

View File

@@ -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_;

View File

@@ -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 {}

View File

@@ -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 {