diff options
Diffstat (limited to 'src/test/main.cpp')
-rw-r--r-- | src/test/main.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/test/main.cpp b/src/test/main.cpp index e6529949e2..5885564074 100644 --- a/src/test/main.cpp +++ b/src/test/main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019 The Bitcoin Core developers +// Copyright (c) 2011-2020 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -11,12 +11,16 @@ #include <test/util/setup_common.h> -/** Redirect debug log to boost log */ +#include <iostream> + +/** Redirect debug log to unit_test.log files */ const std::function<void(const std::string&)> G_TEST_LOG_FUN = [](const std::string& s) { - if (s.back() == '\n') { - // boost will insert the new line - BOOST_TEST_MESSAGE(s.substr(0, s.size() - 1)); - } else { - BOOST_TEST_MESSAGE(s); - } + static const bool should_log{std::any_of( + &boost::unit_test::framework::master_test_suite().argv[1], + &boost::unit_test::framework::master_test_suite().argv[boost::unit_test::framework::master_test_suite().argc], + [](const char* arg) { + return std::string{"DEBUG_LOG_OUT"} == arg; + })}; + if (!should_log) return; + std::cout << s; }; |