!12 api增加日志分片文件大小和文件个数配置接口

Merge pull request !12 from 倔强的土豆/feature/add_log_config
This commit is contained in:
夏楚 2021-10-22 08:02:12 +00:00 committed by Gitee
commit fc4380fffc
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_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

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) {
assert(key && val);
if (mINI::Instance().find(key) == mINI::Instance().end()) {