Bitcoin Core
22.99.0
P2P Digital Currency
src
test
util
logging.h
Go to the documentation of this file.
1
// Copyright (c) 2019-2020 The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_TEST_UTIL_LOGGING_H
6
#define BITCOIN_TEST_UTIL_LOGGING_H
7
8
#include <
util/macros.h
>
9
10
#include <functional>
11
#include <list>
12
#include <string>
13
14
class
DebugLogHelper
15
{
16
const
std::string
m_message
;
17
bool
m_found
{
false
};
18
std::list<std::function<void(
const
std::string&)>>::iterator
m_print_connection
;
19
29
using
MatchFn
= std::function<bool(
const
std::string* line)>;
30
MatchFn
m_match
;
31
32
void
check_found
();
33
34
public
:
35
explicit
DebugLogHelper
(std::string message,
MatchFn
match = [](
const
std::string*){
return
true
; });
36
~DebugLogHelper
() {
check_found
(); }
37
};
38
39
#define ASSERT_DEBUG_LOG(message) DebugLogHelper PASTE2(debugloghelper, __COUNTER__)(message)
40
41
#endif // BITCOIN_TEST_UTIL_LOGGING_H
DebugLogHelper::~DebugLogHelper
~DebugLogHelper()
Definition:
logging.h:36
DebugLogHelper::m_print_connection
std::list< std::function< void(const std::string &)> >::iterator m_print_connection
Definition:
logging.h:18
macros.h
DebugLogHelper
Definition:
logging.h:14
DebugLogHelper::m_message
const std::string m_message
Definition:
logging.h:16
DebugLogHelper::DebugLogHelper
DebugLogHelper(std::string message, MatchFn match=[](const std::string *){ return true;})
Definition:
logging.cpp:13
DebugLogHelper::m_match
MatchFn m_match
Definition:
logging.h:30
DebugLogHelper::m_found
bool m_found
Definition:
logging.h:17
DebugLogHelper::check_found
void check_found()
Definition:
logging.cpp:24
DebugLogHelper::MatchFn
std::function< bool(const std::string *line)> MatchFn
Custom match checking function.
Definition:
logging.h:29
Generated on Fri Feb 18 2022 20:03:19 for Bitcoin Core by
1.8.17