feat: 优化日志系统,添加日志器缓存机制

This commit is contained in:
2025-10-18 08:50:43 +08:00
parent c5c625f50e
commit 5540a9169a
7 changed files with 139 additions and 36 deletions

24
tests/test-logs.c Normal file
View File

@@ -0,0 +1,24 @@
#include "logging.h"
#include "logging/logging-core.h"
#include <stdio.h>
int main() {
Logger *t1 = getLogger("Test1");
t1->level = LOG_ERROR;
Logger *t2 = getLogger("Test2");
t2->level = LOG_DEBUG;
Logger *t11 = getLogger("Test1");
if (t1 == t11) {
printf("t1 and t11 are the same\n");
printf("t1 log level: %s", LOG_LEVEL_STR[t11->level]);
} else {
printf("t1 and t11 are different\n");
return 1;
}
destroyDefaultLogger();
return 0;
}