添加异步日志线程

This commit is contained in:
xiongziliang 2019-12-18 13:54:55 +08:00
parent bf499916d8
commit ee4659a185

View File

@ -48,6 +48,8 @@ API_EXPORT void API_CALL mk_env_init(const config *cfg) {
assert(cfg != nullptr); assert(cfg != nullptr);
static onceToken token([&]() { static onceToken token([&]() {
Logger::Instance().add(std::make_shared<ConsoleChannel>("console", (LogLevel) cfg->log_level)); Logger::Instance().add(std::make_shared<ConsoleChannel>("console", (LogLevel) cfg->log_level));
Logger::Instance().setWriter(std::make_shared<AsyncLogWriter>());
EventPollerPool::setPoolSize(cfg->thread_num); EventPollerPool::setPoolSize(cfg->thread_num);
WorkThreadPool::setPoolSize(cfg->thread_num); WorkThreadPool::setPoolSize(cfg->thread_num);