xrpld
Loading...
Searching...
No Matches
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
10namespace xrpl::test {
11
15class CheckMessageLogs : public Logs
16{
18 bool* pFound_;
19
21 {
23
24 public:
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
44public:
52 CheckMessageLogs(std::string msg, bool* pFound)
53 : Logs{beast::Severity::Debug}, msg_{std::move(msg)}, pFound_{pFound}
54 {
55 }
56
58 makeSink(std::string const& partition, beast::Severity threshold) override
59 {
61 }
62};
63
64} // namespace xrpl::test
Abstraction for the underlying message destination.
Definition Journal.h:59
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:16
STL namespace.