diff --git a/api/include/mk_common.h b/api/include/mk_common.h index 01a6af00..e7b09445 100755 --- a/api/include/mk_common.h +++ b/api/include/mk_common.h @@ -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 配置项名 diff --git a/api/source/mk_common.cpp b/api/source/mk_common.cpp index 1db7057f..840a0424 100644 --- a/api/source/mk_common.cpp +++ b/api/source/mk_common.cpp @@ -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(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()) {