xrpld
Loading...
Searching...
No Matches
CheckMessageLogs.h
1#pragma once
2
3#include <xrpl/basics/Log.h>
4
5namespace xrpl::test {
6
9class CheckMessageLogs : public Logs
10{
12 bool* pFound_;
13
15 {
17
18 public:
20 : beast::Journal::Sink(threshold, false), owner_(owner)
21 {
22 }
23
24 void
25 write(beast::Severity level, std::string const& text) override
26 {
27 if (text.contains(owner_.msg_))
28 *owner_.pFound_ = true;
29 }
30
31 void
32 writeAlways(beast::Severity level, std::string const& text) override
33 {
34 write(level, text);
35 }
36 };
37
38public:
45 CheckMessageLogs(std::string msg, bool* pFound)
46 : Logs{beast::Severity::Debug}, msg_{std::move(msg)}, pFound_{pFound}
47 {
48 }
49
51 makeSink(std::string const& partition, beast::Severity threshold) override
52 {
54 }
55};
56
57} // namespace xrpl::test
Abstraction for the underlying message destination.
Definition Journal.h:51
virtual Severity threshold() const
Returns the minimum severity level this sink will report.
Sink(Sink const &sink)=default
beast::Severity threshold() const
Definition Log.cpp:143
Logs(beast::Severity level)
Definition Log.cpp:112
void writeAlways(beast::Severity level, std::string const &text) override
Bypass filter and write text to the sink at the specified severity.
CheckMessageSink(beast::Severity threshold, CheckMessageLogs &owner)
void write(beast::Severity level, std::string const &text) override
Write text to the sink at the specified severity.
std::unique_ptr< beast::Journal::Sink > makeSink(std::string const &partition, beast::Severity threshold) override
CheckMessageLogs(std::string msg, bool *pFound)
Constructor.
T make_unique(T... args)
Severity
Severity level / threshold of a Journal message.
Definition Journal.h:11
STL namespace.