xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
test
jtx
CheckMessageLogs.h
1
#pragma once
2
3
#include <xrpl/basics/Log.h>
4
#include <xrpl/beast/utility/Journal.h>
5
6
#include <
memory
>
7
#include <
string
>
8
#include <
utility
>
9
10
namespace
xrpl::test
{
11
15
class
CheckMessageLogs
:
public
Logs
16
{
17
std::string
msg_
;
18
bool
*
pFound_
;
19
20
class
CheckMessageSink
:
public
beast::Journal::Sink
21
{
22
CheckMessageLogs
&
owner_
;
23
24
public
:
25
CheckMessageSink
(
beast::Severity
threshold
,
CheckMessageLogs
& owner)
26
:
beast
::Journal::
Sink
(
threshold
, false),
owner_
(owner)
27
{
28
}
29
30
void
31
write
(
beast::Severity
level,
std::string
const
& text)
override
32
{
33
if
(text.contains(
owner_
.msg_))
34
*
owner_
.pFound_ =
true
;
35
}
36
37
void
38
writeAlways
(
beast::Severity
level,
std::string
const
& text)
override
39
{
40
write
(level, text);
41
}
42
};
43
44
public
:
52
CheckMessageLogs
(
std::string
msg,
bool
* pFound)
53
:
Logs
{
beast
::
Severity
::Debug},
msg_
{
std
::move(msg)},
pFound_
{pFound}
54
{
55
}
56
57
std::unique_ptr<beast::Journal::Sink>
58
makeSink
(
std::string
const
& partition,
beast::Severity
threshold
)
override
59
{
60
return
std::make_unique<CheckMessageSink>
(
threshold
, *
this
);
61
}
62
};
63
64
}
// namespace xrpl::test
std::string
beast::Journal::Sink
Abstraction for the underlying message destination.
Definition
Journal.h:59
beast::Journal::Sink::threshold
virtual Severity threshold() const
Returns the minimum severity level this sink will report.
Definition
beast_Journal.cpp:96
beast::Journal::Sink::Sink
Sink(Sink const &sink)=default
xrpl::Logs::threshold
beast::Severity threshold() const
Definition
Log.cpp:143
xrpl::Logs::Logs
Logs(beast::Severity level)
Definition
Log.cpp:112
xrpl::test::CheckMessageLogs::CheckMessageSink::writeAlways
void writeAlways(beast::Severity level, std::string const &text) override
Bypass filter and write text to the sink at the specified severity.
Definition
CheckMessageLogs.h:38
xrpl::test::CheckMessageLogs::CheckMessageSink::owner_
CheckMessageLogs & owner_
Definition
CheckMessageLogs.h:22
xrpl::test::CheckMessageLogs::CheckMessageSink::CheckMessageSink
CheckMessageSink(beast::Severity threshold, CheckMessageLogs &owner)
Definition
CheckMessageLogs.h:25
xrpl::test::CheckMessageLogs::CheckMessageSink::write
void write(beast::Severity level, std::string const &text) override
Write text to the sink at the specified severity.
Definition
CheckMessageLogs.h:31
xrpl::test::CheckMessageLogs::makeSink
std::unique_ptr< beast::Journal::Sink > makeSink(std::string const &partition, beast::Severity threshold) override
Definition
CheckMessageLogs.h:58
xrpl::test::CheckMessageLogs::msg_
std::string msg_
Definition
CheckMessageLogs.h:17
xrpl::test::CheckMessageLogs::pFound_
bool * pFound_
Definition
CheckMessageLogs.h:18
xrpl::test::CheckMessageLogs::CheckMessageLogs
CheckMessageLogs(std::string msg, bool *pFound)
Constructor.
Definition
CheckMessageLogs.h:52
std::make_unique
T make_unique(T... args)
memory
beast
Definition
base_uint.h:697
beast::Severity
Severity
Severity level / threshold of a Journal message.
Definition
Journal.h:16
std
STL namespace.
xrpl::test
Definition
STLedgerEntry.h:21
string
std::unique_ptr
utility
Generated by
1.17.0