Dev test on windows action (#9)
* #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 不支持中文注释,删除中文注释
This commit is contained in:
@@ -5,10 +5,17 @@ enable_testing()
|
||||
#测试简单基本应用
|
||||
add_executable(${PROJECT_NAME}simple test_simple.c)
|
||||
target_link_libraries(${PROJECT_NAME}simple logging)
|
||||
add_test(test_simple ${CMAKE_SOURCE_DIR}/bin/${PROJECT_NAME}simple)
|
||||
|
||||
if(UNIX)
|
||||
add_test(test_simple ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}simple)
|
||||
elseif(WIN32)
|
||||
add_test(test_simple ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}simple.exe)
|
||||
endif()
|
||||
|
||||
#测试拦截器
|
||||
add_executable(${PROJECT_NAME}interceptor test_interceptor.c)
|
||||
target_link_libraries(${PROJECT_NAME}interceptor logging)
|
||||
add_test(test_interceptor ${CMAKE_SOURCE_DIR}/bin/${PROJECT_NAME}interceptor)
|
||||
if(UNIX)
|
||||
add_test(test_interceptor ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}interceptor)
|
||||
elseif(WIN32)
|
||||
add_test(test_interceptor ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}interceptor.exe)
|
||||
endif()
|
||||
@@ -6,15 +6,15 @@ int main() {
|
||||
Logger *logger = log->getLogger("testLogger", LOG_DEBUG);
|
||||
|
||||
logger->info("This is an info message");
|
||||
logger->error("你好,这是一个错误消息%s", "123");
|
||||
logger->error("This is an error message%s", "123");
|
||||
logger->fatal("This is an fatal message");
|
||||
logger->debug("This is a debug message");
|
||||
logger->warning("This is a warning message%s", "123");
|
||||
|
||||
char *test1[] = {"123", "你好"}; // 要拦截的字符串
|
||||
// 添加拦截器,将拦截到的日志重定向到拦截器的专属处理器中
|
||||
char *test1[] = {"123", "tt"};
|
||||
|
||||
log_Interceptor *tint =
|
||||
loggingSubStringInterceptor(test1, 2, LOG_DEBUG, loggingFileHandler("被拦截"));
|
||||
loggingSubStringInterceptor(test1, 2, LOG_DEBUG, loggingFileHandler("test_interceptor"));
|
||||
|
||||
logger->addInterceptor(tint);
|
||||
|
||||
@@ -23,7 +23,7 @@ int main() {
|
||||
printf("\n");
|
||||
|
||||
logger->info("This is an info message");
|
||||
logger->error("你好,这是一个错误消息%s", "123");
|
||||
logger->error("This is an error message%s", "123");
|
||||
logger->fatal("This is an fatal message");
|
||||
logger->debug("This is a debug message");
|
||||
logger->warning("This is a warning message%s", "123");
|
||||
|
||||
@@ -5,7 +5,7 @@ int main() {
|
||||
Logger *logger = log->getLogger("testLogger", LOG_DEBUG);
|
||||
|
||||
logger->info("This is an info message");
|
||||
logger->error("你好,这是一个错误消息%s", "123");
|
||||
logger->error("This is an error message%s", "123");
|
||||
logger->fatal("This is an fatal message");
|
||||
logger->debug("This is a debug message");
|
||||
logger->warning("This is a warning message%s", "123");
|
||||
|
||||
Reference in New Issue
Block a user