nullptr default, astyle
This commit is contained in:
parent
d47fbbb79e
commit
384cdeb225
@ -125,9 +125,9 @@ private:
|
||||
|
||||
// last exception thrown from the worker thread
|
||||
std::shared_ptr<spdlog_ex> _last_workerthread_ex;
|
||||
|
||||
// worker thread warmup callback - one can set thread priority, affinity, etc
|
||||
const std::function<void()> _worker_warmup_cb;
|
||||
|
||||
// worker thread warmup callback - one can set thread priority, affinity, etc
|
||||
const std::function<void()> _worker_warmup_cb;
|
||||
|
||||
|
||||
// throw last worker thread exception or if worker thread is not active
|
||||
@ -154,7 +154,7 @@ inline spdlog::details::async_log_helper::async_log_helper(formatter_ptr formatt
|
||||
_formatter(formatter),
|
||||
_sinks(sinks),
|
||||
_q(queue_size),
|
||||
_worker_warmup_cb(worker_warmup_cb),
|
||||
_worker_warmup_cb(worker_warmup_cb),
|
||||
_worker_thread(&async_log_helper::worker_loop, this)
|
||||
{}
|
||||
|
||||
@ -194,7 +194,7 @@ inline void spdlog::details::async_log_helper::worker_loop()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_worker_warmup_cb) _worker_warmup_cb();
|
||||
if (_worker_warmup_cb) _worker_warmup_cb();
|
||||
clock::time_point last_pop = clock::now();
|
||||
while(process_next_msg(last_pop));
|
||||
}
|
||||
|
@ -44,7 +44,10 @@ inline spdlog::async_logger::async_logger(const std::string& logger_name, sinks_
|
||||
async_logger(logger_name, sinks.begin(), sinks.end(), queue_size, worker_warmup_cb) {}
|
||||
|
||||
inline spdlog::async_logger::async_logger(const std::string& logger_name, sink_ptr single_sink, size_t queue_size, const std::function<void()>& worker_warmup_cb) :
|
||||
async_logger(logger_name, { single_sink }, queue_size, worker_warmup_cb) {}
|
||||
async_logger(logger_name,
|
||||
{
|
||||
single_sink
|
||||
}, queue_size, worker_warmup_cb) {}
|
||||
|
||||
|
||||
inline void spdlog::async_logger::_set_formatter(spdlog::formatter_ptr msg_formatter)
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
_async_mode = true;
|
||||
_async_q_size = q_size;
|
||||
_worker_warmup_cb = worker_warmup_cb;
|
||||
_worker_warmup_cb = worker_warmup_cb;
|
||||
}
|
||||
|
||||
void set_sync_mode()
|
||||
@ -151,7 +151,7 @@ private:
|
||||
level::level_enum _level = level::info;
|
||||
bool _async_mode = false;
|
||||
size_t _async_q_size = 0;
|
||||
std::function<void()> _worker_warmup_cb = nullptr;
|
||||
std::function<void()> _worker_warmup_cb = nullptr;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ void set_level(level::level_enum log_level);
|
||||
|
||||
// Turn on async mode and set the queue size for each async_logger
|
||||
|
||||
void set_async_mode(size_t queue_size, const std::function<void()>& worker_warmup_cb);
|
||||
void set_async_mode(size_t queue_size, const std::function<void()>& worker_warmup_cb = nullptr);
|
||||
// Turn off async mode
|
||||
void set_sync_mode();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user