Skip to content

Commit

Permalink
Fixed some issues with build under Windows and added a test for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jgaa committed Mar 9, 2024
1 parent f75dee3 commit 29fb05f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
5 changes: 5 additions & 0 deletions include/logfault/logfault.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ Home: https://github.com/jgaa/logfault
# endif
#endif

#ifdef ERROR
// Thank you SOOO much Microsoft!
# undef ERROR
#endif


namespace logfault {

Expand Down
12 changes: 6 additions & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ set_property(TARGET default_to_clog PROPERTY CXX_STANDARD 11)

target_include_directories(default_to_clog
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}
$<BUILD_INTERFACE:${LOGFAULT_ROOT}/include
$<BUILD_INTERFACE:${GTEST_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
${LOGFAULT_ROOT}/include
${GTEST_INCLUDE_DIRS}
)

target_link_libraries(default_to_clog
Expand All @@ -49,9 +49,9 @@ set_property(TARGET default_to_clog_with_tid PROPERTY CXX_STANDARD 11)

target_include_directories(default_to_clog_with_tid
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}
$<BUILD_INTERFACE:${LOGFAULT_ROOT}/include
$<BUILD_INTERFACE:${GTEST_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
${LOGFAULT_ROOT}/include
${GTEST_INCLUDE_DIRS}
)

target_link_libraries(default_to_clog_with_tid
Expand Down
16 changes: 16 additions & 0 deletions tests/default_to_clog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,22 @@ TEST(Logfault, HelloTid) {
}
#endif

#if defined(WIN32) && defined(LOGFAULT_USE_TID_AS_NAME)
TEST(Logfault, HelloTid) {

string output;
{
ClogRedirector redir{ output };
LFLOG_INFO << "Test log";
}

regex pattern{ R"(.* INFO [0-9]{1,10} Test log.*)" };
EXPECT_TRUE(regex_search(output, pattern));
cout << "Output: " << output << endl;
}
#endif


int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);

Expand Down

0 comments on commit 29fb05f

Please sign in to comment.