From a0a7dd01a6c6343d397d263f6dbd6e5cacccf244 Mon Sep 17 00:00:00 2001 From: JYJSXX <95729892+JYJSXX@users.noreply.github.com> Date: Sun, 8 Sep 2024 13:51:36 +0800 Subject: [PATCH] test --- src/CMakeLists.txt | 4 ++++ src/main.cpp | 3 --- src/test_logging.cpp | 11 +++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/test_logging.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 722da09..cd98630 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,7 @@ add_executable( lab0_debug main.cpp Human.cpp Student.cpp logging.cpp +) + +add_executable( + test_logging test_logging.cpp ) \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 225dc20..0669233 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,7 +4,6 @@ #include #include "Human.hpp" #include "Student.hpp" -#include "logging.hpp" #include class check{ @@ -32,8 +31,6 @@ int main(int argc, char** argv){ auto student1 = static_cast(vec.back()); // check check1 = check(vec.back()); //TODO: Error 2 : why? check check1 = check(student1); - // LOG(DEBUG) << student1->print(); - // LOG(WARNING) << human.print(); // std::list list; // list.push_back(1); diff --git a/src/test_logging.cpp b/src/test_logging.cpp new file mode 100644 index 0000000..f58f868 --- /dev/null +++ b/src/test_logging.cpp @@ -0,0 +1,11 @@ +#include "logging.hpp" +// 引入头文件 +int main(){ + LOG(DEBUG) << "This is DEBUG log item."; + // 使用关键字 LOG,括号中填入要输出的日志等级 + // 紧接着就是<<以及日志的具体信息,就跟使用 std::cout 一样 + LOG(INFO) << "This is INFO log item"; + LOG(WARNING) << "This is WARNING log item"; + LOG(ERROR) << "This is ERROR log item"; + return 0; +} \ No newline at end of file -- GitLab