Expose the flusher thread object to user in order to allow setting of thread name and thread affinity when needed

pull/3009/head
Dan Cohen 2 years ago
parent 696db97f67
commit 0e5cd15f1c

@ -38,6 +38,7 @@ public:
}
});
}
std::thread *get_thread() { return &worker_thread_; }
periodic_worker(const periodic_worker &) = delete;
periodic_worker &operator=(const periodic_worker &) = delete;
// stop the worker thread and join it

@ -68,6 +68,8 @@ public:
periodic_flusher_ = details::make_unique<periodic_worker>(clbk, interval);
}
std::unique_ptr<periodic_worker> &get_flusher() { return periodic_flusher_; }
void set_error_handler(err_handler handler);
void apply_all(const std::function<void(const std::shared_ptr<logger>)> &fun);

@ -89,4 +89,9 @@ SPDLOG_INLINE void apply_logger_env_levels(std::shared_ptr<logger> logger) {
details::registry::instance().apply_logger_env_levels(std::move(logger));
}
SPDLOG_INLINE std::unique_ptr<spdlog::details::periodic_worker> &get_flusher()
{
return details::registry::instance().get_flusher();
}
} // namespace spdlog

Loading…
Cancel
Save