Closed xiaguan closed 1 year ago
We will get this merged this Sunday so as to avoid breaking some students' setup.
... it's the deadline for project 1 and the start of project 2
This is the first time I use pull request. Not familiar with the process, sorry.
Don’t worry, you are on the right track!
The
#if
command only finds the macro definition. If it is not found, it defaults to 0. ButLOG_LEVEL
is a C++'s constexpr variable which the compiler will process after the#if
command. So what ever the LOG_LEVEL is , the logger will print all log. If you still want to use constexpr variable , maybe you should use the template technology instead of#if
. In my opinion, it is feasible and inexpensive to simply replace it with a macro definition. Finally, a new function suggests that for concurrent programs, the log should carry the thread id, and users can simply control the format, log level filtering, or users prefer streaming output log, and so on. If you need, I can provide header-only one.