api增加log日志文件参数设置

This commit is contained in:
cgm 2021-09-28 09:52:29 +08:00
parent 10c4608630
commit 8b1bccdd00
2 changed files with 15 additions and 0 deletions

View File

@ -106,6 +106,13 @@ API_EXPORT void API_CALL mk_env_init1(int thread_num,
const char *ssl, const char *ssl,
const char *ssl_pwd); const char *ssl_pwd);
/**
*
* @param file_max_size (MB)
* @param file_max_count
*/
API_EXPORT void API_CALL mk_set_log(int file_max_size, int file_max_count);
/** /**
* *
* @param key * @param key

View File

@ -121,6 +121,14 @@ API_EXPORT void API_CALL mk_env_init1(int thread_num,
}); });
} }
API_EXPORT void API_CALL mk_set_log(int file_max_size, int file_max_count) {
auto channel = dynamic_pointer_cast<FileChannel>(Logger::Instance().get("FileChannel"));
if (channel) {
channel->setFileMaxSize(file_max_size);
channel->setFileMaxCount(file_max_count);
}
}
API_EXPORT void API_CALL mk_set_option(const char *key, const char *val) { API_EXPORT void API_CALL mk_set_option(const char *key, const char *val) {
assert(key && val); assert(key && val);
if (mINI::Instance().find(key) == mINI::Instance().end()) { if (mINI::Instance().find(key) == mINI::Instance().end()) {