新增C API 广播日志到上层应用

This commit is contained in:
kevin cheng
2021-08-30 19:03:20 +08:00
parent d2f02c0a0c
commit 5bd169e6de
6 changed files with 82 additions and 4 deletions

View File

@@ -48,6 +48,8 @@ typedef struct {
const char *log_file_path;
//文件日志保存天数,设置为0关闭日志文件
int log_file_days;
// 是否关闭 控制台 日志
int disable_console_log;
// 配置文件是内容还是路径
int ini_is_path;
@@ -94,6 +96,29 @@ API_EXPORT void API_CALL mk_env_init1(int thread_num,
int ssl_is_path,
const char *ssl,
const char *ssl_pwd);
/**
* 基础类型参数版本的mk_env_init为了方便其他语言调用
* @param thread_num 线程数
* @param log_level 日志级别,支持0~4
* @param log_file_path 文件日志保存路径,路径可以不存在(内部可以创建文件夹)设置为NULL关闭日志输出至文件
* @param log_file_days 文件日志保存天数,设置为0关闭日志文件
* @param ini_is_path 配置文件是内容还是路径
* @param ini 配置文件内容或路径可以为NULL,如果该文件不存在,那么将导出默认配置至该文件
* @param ssl_is_path ssl证书是内容还是路径
* @param ssl ssl证书内容或路径可以为NULL
* @param ssl_pwd 证书密码可以为NULL
* @param disable_console_log 是否关闭 控制台 日志
*/
API_EXPORT void API_CALL mk_env_init2(int thread_num,
int log_level,
const char *log_file_path,
int log_file_days,
int ini_is_path,
const char *ini,
int ssl_is_path,
const char *ssl,
const char *ssl_pwd,
int disable_console_log);
/**
* 设置配置项

View File

@@ -152,6 +152,18 @@ typedef struct {
size_t total_seconds,
int is_player,
const mk_sock_info sender);
/**
* 日志输出广播
* @param level 日志级别
* @param file 源文件名
* @param line 源文件行
* @param function 源文件方法
* @param message 日志内容
*/
void (API_CALL *on_mk_log)(int level, const char* file, int line, const char *function, const char* message);
} mk_events;