28
README.en.md
28
README.en.md
@@ -48,7 +48,7 @@ int main() {
|
||||
|
||||
int main() {
|
||||
Logger *logger = newDefaultLogger("testLogger", LOG_DEBUG);
|
||||
logger->addHandler(loggingFileHandler("test1", 1024*1024));
|
||||
logger->addHandler(loggingHandlerFile("test1", 1024*1024));
|
||||
|
||||
log_info("This is an info message");
|
||||
log_error("This is an error message%s", "123");
|
||||
@@ -61,9 +61,9 @@ int main() {
|
||||
}
|
||||
```
|
||||
|
||||
### Logging Interceptor
|
||||
### Logging filter
|
||||
> Support adding custom interceptors, currently with built-in substring interceptors
|
||||
> The function of an interceptor is to redirect intercepted logs to the interceptor's dedicated processor
|
||||
> The function of an filter is to redirect intercepted logs to the filter's dedicated processor
|
||||
|
||||
|
||||
#### example
|
||||
@@ -83,16 +83,16 @@ int main() {
|
||||
|
||||
char *test1[] = {"123", "tt", NULL};
|
||||
|
||||
log_Interceptor *tint = loggingSubStringInterceptor(
|
||||
log_filter *tint = loggingFilterSubStr(
|
||||
test1,
|
||||
LOG_DEBUG,
|
||||
loggingFileHandler("test_interceptor", 1024 * 1024),
|
||||
loggingHandlerFile("test_interceptor", 1024 * 1024),
|
||||
true);
|
||||
|
||||
logger->addInterceptor(tint);
|
||||
logger->addFilter(tint);
|
||||
|
||||
printf("\n");
|
||||
printf("Interceptor added\n");
|
||||
printf("filter added\n");
|
||||
printf("\n");
|
||||
|
||||
log_info("This is an info message");
|
||||
@@ -124,26 +124,26 @@ int main() {
|
||||
|
||||
char *test1[] = {"This",NULL};
|
||||
|
||||
log_Interceptor *tint = loggingSubStringInterceptor(
|
||||
log_filter *tint = loggingFilterSubStr(
|
||||
test1,
|
||||
LOG_DEBUG,
|
||||
loggingFileHandler("test_interceptor", 1024 * 1024),
|
||||
loggingHandlerFile("test_interceptor", 1024 * 1024),
|
||||
false);
|
||||
|
||||
logger->addInterceptor(tint);
|
||||
logger->addFilter(tint);
|
||||
|
||||
char *test2[] = {"123",NULL};
|
||||
|
||||
log_Interceptor *tint1 = loggingSubStringInterceptor(
|
||||
log_filter *tint1 = loggingFilterSubStr(
|
||||
test2,
|
||||
LOG_DEBUG,
|
||||
loggingFileHandler("test_interceptor1", 1024 * 1024),
|
||||
loggingHandlerFile("test_interceptor1", 1024 * 1024),
|
||||
true);
|
||||
|
||||
logger->addInterceptor(tint1);
|
||||
logger->addFilter(tint1);
|
||||
|
||||
printf("\n");
|
||||
printf("Interceptor added\n");
|
||||
printf("filter added\n");
|
||||
printf("\n");
|
||||
|
||||
log_info("This is an info message");
|
||||
|
||||
Reference in New Issue
Block a user