rippled
Loading...
Searching...
No Matches
CaptureLogs.h
1#ifndef XRPL_TEST_JTX_CAPTURELOGS_H_INCLUDED
2#define XRPL_TEST_JTX_CAPTURELOGS_H_INCLUDED
3
4#include <xrpl/basics/Log.h>
5
6namespace ripple {
7namespace test {
8
15class CaptureLogs : public Logs
16{
20
25 {
28
29 public:
32 std::mutex& mutex,
34 : beast::Journal::Sink(threshold, false)
35 , strmMutex_(mutex)
36 , strm_(strm)
37 {
38 }
39
40 void
42 override
43 {
45 strm_ << text;
46 }
47
48 void
50 override
51 {
53 strm_ << text;
54 }
55 };
56
57public:
58 explicit CaptureLogs(std::string* pResult)
59 : Logs(beast::severities::kInfo), pResult_(pResult)
60 {
61 }
62
63 ~CaptureLogs() override
64 {
65 *pResult_ = strm_.str();
66 }
67
75};
76
77} // namespace test
78} // namespace ripple
79
80#endif
Abstraction for the underlying message destination.
Definition Journal.h:57
virtual Severity threshold() const
Returns the minimum severity level this sink will report.
Manages partitions for logging.
Definition Log.h:33
beast::severities::Severity threshold() const
Definition Log.cpp:147
sink for writing all log messages to a stringstream
Definition CaptureLogs.h:25
void write(beast::severities::Severity level, std::string const &text) override
Write text to the sink at the specified severity.
Definition CaptureLogs.h:41
CaptureSink(beast::severities::Severity threshold, std::mutex &mutex, std::stringstream &strm)
Definition CaptureLogs.h:30
void writeAlways(beast::severities::Severity level, std::string const &text) override
Bypass filter and write text to the sink at the specified severity.
Definition CaptureLogs.h:49
Log manager for CaptureSinks.
Definition CaptureLogs.h:16
CaptureLogs(std::string *pResult)
Definition CaptureLogs.h:58
std::unique_ptr< beast::Journal::Sink > makeSink(std::string const &partition, beast::severities::Severity threshold) override
Definition CaptureLogs.h:69
std::stringstream strm_
Definition CaptureLogs.h:18
T is_same_v
Severity
Severity level / threshold of a Journal message.
Definition Journal.h:13
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
T str(T... args)