refactor: 优化日志系统,支持多日志器

This commit is contained in:
2025-09-15 13:35:16 +08:00
parent 8ac539eb79
commit 9fce78a59e
5 changed files with 237 additions and 119 deletions

View File

@@ -2,15 +2,15 @@
#include "logging/logging-handler.h"
int main() {
Logger *logger = newDefaultLogger("testLogger", LOG_DEBUG);
initDefaultLogger("testLogger", LOG_DEBUG);
log_Handler *hander = loggingHandlerFile("test_log", 1024 * 1024 * 10);
logger->addHandler(hander);
addHandler(getDefaultLogger(), hander);
log_info("This is an info message");
log_error("This is an error message%s", "123");
log_fatal("This is an fatal message");
log_debug("This is a debug message");
log_warning("This is a warning message%s", "123");
Log_info("This is an info message");
Log_error("This is an error message%s", "123");
Log_fatal("This is an fatal message");
Log_debug("This is a debug message");
Log_warning("This is a warning message%s", "123");
destroyDefaultLogger();
return 0;