Updating files to 1.4.9
This commit is contained in:
parent
6bcd6ab229
commit
51d9a002e3
@ -1,4 +1,5 @@
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <condition_variable>
|
||||
#include <cassert>
|
||||
@ -10,7 +11,7 @@
|
||||
using namespace std;
|
||||
using namespace ts::event;
|
||||
|
||||
EventExecutor::EventExecutor(const std::string& thread_prefix) : _thread_prefix(thread_prefix) {}
|
||||
EventExecutor::EventExecutor(std::string thread_prefix) : _thread_prefix{std::move(thread_prefix)} {}
|
||||
EventExecutor::~EventExecutor() {
|
||||
unique_lock lock(this->lock);
|
||||
this->_shutdown(lock);
|
||||
|
@ -43,7 +43,7 @@ namespace ts {
|
||||
|
||||
class EventExecutor {
|
||||
public:
|
||||
explicit EventExecutor(const std::string& /* thread prefix */);
|
||||
explicit EventExecutor(std::string /* thread prefix */);
|
||||
virtual ~EventExecutor();
|
||||
|
||||
bool initialize(int /* num threads */);
|
||||
|
@ -35,7 +35,12 @@ namespace logger {
|
||||
cout << message;
|
||||
}
|
||||
|
||||
void TerminalSink::flush_() {}
|
||||
void TerminalSink::flush_() {
|
||||
#ifdef HAVE_CXX_TERMINAL
|
||||
if(!terminal::active())
|
||||
#endif
|
||||
std::cout.flush();
|
||||
}
|
||||
|
||||
|
||||
inline void append_time(const log_clock::time_point& point, memory_buf_t& dest) {
|
||||
|
@ -137,14 +137,17 @@ namespace logger {
|
||||
}
|
||||
sinks.push_back(terminalSink);
|
||||
|
||||
if(!logging_threads)
|
||||
if(!logging_threads && !logConfig->sync)
|
||||
logging_threads = std::make_shared<spdlog::details::thread_pool>(8192, 1); //Only one thread possible here, else elements get reordered
|
||||
#ifdef ASYNC_LOG
|
||||
auto logger = std::make_shared<spdlog::async_logger>("Logger (" + path + ")", sinks.begin(), sinks.end(), logging_threads, async_overflow_policy::block);
|
||||
#else
|
||||
//FIXME!
|
||||
auto logger = create("Logger (" + path + ")", sinks.begin(), sinks.end());
|
||||
#endif
|
||||
|
||||
std::shared_ptr<spdlog::logger> logger;
|
||||
if(!logConfig->sync) {
|
||||
logger = std::make_shared<spdlog::async_logger>("Logger (" + path + ")", sinks.begin(), sinks.end(), logging_threads, async_overflow_policy::block);
|
||||
} else {
|
||||
logger = std::make_shared<spdlog::logger>("Logger (" + path + ")", sinks.begin(), sinks.end());
|
||||
logger->flush_on(level::trace);
|
||||
}
|
||||
|
||||
updater_logger_levels(logger);
|
||||
loggers[group] = logger;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ namespace logger {
|
||||
struct LoggerConfig {
|
||||
spdlog::level::level_enum logfileLevel = spdlog::level::info;
|
||||
spdlog::level::level_enum terminalLevel = spdlog::level::info;
|
||||
bool sync{false};
|
||||
bool file_colored;
|
||||
std::string logPath = "log_${time}.log";
|
||||
size_t vs_group_size = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user