* #feat 增强Fatal级别的底色,修改logging类的方法

* 更新版本号

* 加入test脚本

* fix:conanfile

* test action

* 修复错别字

* add test on windows action

* fix test on windows action

* fix action on windows

* fix

* fix 内存分配错误

* fix msvc 不支持中文注释,删除中文注释

* test on windows and test  chinese char

* ersion 0.2.4

* feature:根据文件大小分割日志

* fix:内存泄露

* fix:使用char偏移单位
This commit is contained in:
youmetme
2024-11-20 11:56:47 +08:00
committed by GitHub
parent 650ce0dc3f
commit d0bfc31563
13 changed files with 231 additions and 93 deletions

View File

@@ -8,6 +8,9 @@
#include "logging/logging-handler.h"
#include "logging/logging-interceptor.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct Logger {
log_level level;
@@ -20,18 +23,35 @@ typedef struct Logger {
void (*info)(const char *format, ...);
void (*debug)(const char *format, ...);
void (*addHandler)(log_Handler *handler);
void (*addInterceptor)(log_Interceptor *Interceptor);
bool (*addHandler)(log_Handler *handler);
bool (*addInterceptor)(log_Interceptor *Interceptor);
} Logger;
/**
* @brief 创建日志对象,日志对象为单例模式后续可通过getDefaultLogger方法获取
重复调用该方法不会创建新的日志对象,只会返回默认日志对象,并且会修改默认日志对象的名称和等级
* @param name 日志名称
* @param level 日志等级
* @return Logger* 日志对象指针
*/
Logger *newLogger(const char *name, log_level level);
/**
* @brief 设置日志等级
* @param logger 日志对象
* @param level 日志等级
*/
log_status setLevel(Logger *logger, log_level level);
/**
* @brief 获取默认日志对象
*/
Logger *getDefaultLogger(void);
/**
* @brief 销毁日志对象,该方法会销毁默认日志对象
*/
log_status destroyLogger(void);
typedef struct Logging {
Logger *(*getLogger)(const char *name, log_level level);
log_status (*setLevel)(Logger *logger, log_level level);
Logger *(*getCurrentLogger)(void);
log_status (*destroyLogging)(struct Logging *logging);
} Logging;
Logging *newLogging();
#ifdef __cplusplus
}
#endif
#endif // __LOGGING_H__