diff options
| author | yangwei <[email protected]> | 2023-05-30 18:59:08 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2023-05-31 11:26:49 +0800 |
| commit | 7fa29b1a00b1d33c85f73686260d674b66ffb9e9 (patch) | |
| tree | db6217ddd466f1e1870899a8622ab881583b6f99 /inc | |
| parent | 8680c2f4f5639dbdabfa383b1d0819aabd7cc652 (diff) | |
🎈 perf(MESA_handle_runtime_log): 内部增加判断level的级别,提供宏展开示例
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/MESA_handle_logger.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/inc/MESA_handle_logger.h b/inc/MESA_handle_logger.h index 970e50d..49cee4a 100644 --- a/inc/MESA_handle_logger.h +++ b/inc/MESA_handle_logger.h @@ -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 } |
