From 8b1bccdd0033ece41d66d57ff6a22dacbea87fea Mon Sep 17 00:00:00 2001 From: cgm <2958580318@qq.com> Date: Tue, 28 Sep 2021 09:52:29 +0800 Subject: [PATCH] =?UTF-8?q?api=E5=A2=9E=E5=8A=A0log=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=8F=82=E6=95=B0=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/include/mk_common.h | 7 +++++++ api/source/mk_common.cpp | 8 ++++++++ 2 files changed, 15 insertions(+) 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()) {