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