🎈 perf(MESA_handle_runtime_log): 内部增加判断level的级别,提供宏展开示例

This commit is contained in:
yangwei
2023-05-30 18:59:08 +08:00
parent 8680c2f4f5
commit 7fa29b1a00
2 changed files with 29 additions and 16 deletions

View File

@@ -19,8 +19,6 @@ extern "C"
#define RLOG_LV_FATAL 30
struct log_handle_t;
int MESA_handle_runtime_log_creation(const char *conf_path);
int MESA_handle_runtime_log_reconstruction(const char *conf_path);
void MESA_handle_runtime_log_destruction();
@@ -30,7 +28,18 @@ void MESA_handle_runtime_log_destruction();
__FILE__, __LINE__, ##args)
int MESA_handle_runtime_log_level_enabled(struct log_handle_t *handle, const int level);
/*
#define MESA_HANDLE_RUNTIME_LOG_EXPAND(handle, level, module, fmt, ...) \
{ \
if (MESA_handle_runtime_log_level_enabled(handle, level)) \
{ \
MESA_handle_runtime_log(handle, level, module, fmt, __VA_ARGS__); \
} \
}
*/
int MESA_handle_runtime_log_level_enabled(void *handle, const int level);
/*
* name: MESA_create_runtime_log_handle
* functionality: get runtime_log handle;
@@ -41,7 +50,7 @@ int MESA_handle_runtime_log_level_enabled(struct log_handle_t *handle, const int
* not NULL, if succeeded;
* NULL, if file is not absolute path, or failed to create log file;
*/
struct log_handle_t *MESA_create_runtime_log_handle(const char *file_path, int level);
void *MESA_create_runtime_log_handle(const char *file_path, int level);
/*
* name: MESA_handle_runtime_log
@@ -55,7 +64,7 @@ struct log_handle_t *MESA_create_runtime_log_handle(const char *file_path, int l
* returns:
* none;
*/
void MESA_handle_runtime_log(struct log_handle_t *handle, int level, const char *module, const char *fmt, ...);
void MESA_handle_runtime_log(void *handle, int level, const char *module, const char *fmt, ...);
/*
* name: MESA_destroy_runtime_log_handle
@@ -65,7 +74,7 @@ void MESA_handle_runtime_log(struct log_handle_t *handle, int level, const char
* returns:
* none;
*/
void MESA_destroy_runtime_log_handle(struct log_handle_t *handle);
void MESA_destroy_runtime_log_handle(void *handle);
#ifdef __cplusplus
}