mirror of
https://github.com/gabime/spdlog.git
synced 2025-11-16 09:28:56 +08:00
code formatting and clang tidy warnings fixes
This commit is contained in:
@@ -47,7 +47,7 @@ inline void spdlog::async_logger::sink_it_(details::log_msg &msg)
|
||||
}
|
||||
else
|
||||
{
|
||||
throw spdlog_ex("async log: thread pool doens't exist anymore");
|
||||
throw spdlog_ex("async log: thread pool doesn't exist anymore");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
//
|
||||
|
||||
#include "spdlog/details/null_mutex.h"
|
||||
#include "stdio.h"
|
||||
#include <cstdio>
|
||||
#include <mutex>
|
||||
|
||||
namespace spdlog {
|
||||
namespace details {
|
||||
struct console_stdout
|
||||
{
|
||||
static FILE *stream()
|
||||
static std::FILE *stream()
|
||||
{
|
||||
return stdout;
|
||||
}
|
||||
@@ -26,7 +26,7 @@ struct console_stdout
|
||||
|
||||
struct console_stderr
|
||||
{
|
||||
static FILE *stream()
|
||||
static std::FILE *stream()
|
||||
{
|
||||
return stderr;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ static const char *ampm(const tm &t)
|
||||
return t.tm_hour >= 12 ? "PM" : "AM";
|
||||
}
|
||||
|
||||
static unsigned int to12h(const tm &t)
|
||||
static int to12h(const tm &t)
|
||||
{
|
||||
return t.tm_hour > 12 ? t.tm_hour - 12 : t.tm_hour;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ class f_formatter SPDLOG_FINAL : public flag_formatter
|
||||
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
|
||||
{
|
||||
auto micros = fmt_helper::time_fraction<std::chrono::microseconds>(msg.time);
|
||||
fmt_helper::pad6(static_cast<int>(micros.count()), dest);
|
||||
fmt_helper::pad6(static_cast<size_t>(micros.count()), dest);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -745,7 +745,6 @@ private:
|
||||
{
|
||||
formatters_.push_back(std::move(user_chars));
|
||||
}
|
||||
// if(
|
||||
if (++it != end)
|
||||
{
|
||||
handle_flag_(*it);
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace details {
|
||||
class periodic_worker
|
||||
{
|
||||
public:
|
||||
periodic_worker(std::function<void()> callback_fun, std::chrono::seconds interval)
|
||||
periodic_worker(const std::function<void()> &callback_fun, std::chrono::seconds interval)
|
||||
{
|
||||
active_ = (interval > std::chrono::seconds::zero());
|
||||
if (!active_)
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
std::lock_guard<std::mutex> lock(logger_map_mutex_);
|
||||
auto logger_name = new_logger->name();
|
||||
throw_if_exists_(logger_name);
|
||||
loggers_[logger_name] = new_logger;
|
||||
loggers_[logger_name] = std::move(new_logger);
|
||||
}
|
||||
|
||||
void register_and_init(std::shared_ptr<logger> new_logger)
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
new_logger->flush_on(flush_level_);
|
||||
|
||||
// add to registry
|
||||
loggers_[logger_name] = new_logger;
|
||||
loggers_[logger_name] = std::move(new_logger);
|
||||
}
|
||||
|
||||
std::shared_ptr<logger> get(const std::string &logger_name)
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
err_handler_ = handler;
|
||||
}
|
||||
|
||||
void apply_all(std::function<void(std::shared_ptr<logger>)> fun)
|
||||
void apply_all(const std::function<void(const std::shared_ptr<logger>)> &fun)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(logger_map_mutex_);
|
||||
for (auto &l : loggers_)
|
||||
@@ -189,11 +189,7 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
~registry()
|
||||
{
|
||||
/*std::lock_guard<std::mutex> lock(flusher_mutex_);
|
||||
periodic_flusher_.reset();*/
|
||||
}
|
||||
~registry() = default;
|
||||
|
||||
void throw_if_exists_(const std::string &logger_name)
|
||||
{
|
||||
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
}
|
||||
for (size_t i = 0; i < threads_n; i++)
|
||||
{
|
||||
threads_.emplace_back(std::bind(&thread_pool::worker_loop_, this));
|
||||
threads_.emplace_back(&thread_pool::worker_loop_, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user