Multiple substring interceptors

This commit is contained in:
2024-11-21 15:04:21 +08:00
parent 6ac7afd4c2
commit b9abf6c7d3
6 changed files with 243 additions and 88 deletions

View File

@@ -1,8 +1,10 @@
#include "logging.h"
#include <stdbool.h>
#include <stdio.h>
#include <time.h>
int main() {
Logger *logger = newDefaultLogger("testLogger", LOG_DEBUG);
Logger *logger = newDefaultLogger("testLogger", LOG_DEBUG);
log_info("This is an info message");
log_error("This is an error message%s", "123");
@@ -10,16 +12,26 @@ int main() {
log_debug("This is a debug message");
log_warning("This is a warning message%s", "123");
char *test1[] = {"123", "tt"};
char *test1[] = {"This",NULL};
log_Interceptor *tint = loggingSubStringInterceptor(
test1,
2,
LOG_DEBUG,
loggingFileHandler("test_interceptor", 1024 * 1024));
loggingFileHandler("test_interceptor", 1024 * 1024),
false);
logger->addInterceptor(tint);
char *test2[] = {"123",NULL};
log_Interceptor *tint1 = loggingSubStringInterceptor(
test2,
LOG_DEBUG,
loggingFileHandler("test_interceptor1", 1024 * 1024),
true);
logger->addInterceptor(tint1);
printf("\n");
printf("Interceptor added\n");
printf("\n");