diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 722da0930f6369e8ca428ce8099f3a116d5a551c..cd9863020f7a636a6b7bd2f4386d1c5c681a2d40 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 225dc2097c80d8d890b2d86bb18969f38b96d44d..0669233e80ca9bae88dd726d28609190e288702a 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 0000000000000000000000000000000000000000..f58f8687b1dda8c5176e667b793031c580c35b30 --- /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