rippled
Loading...
Searching...
No Matches
CaptureLogs.h
1#pragma once
2
3#include <xrpl/basics/Log.h>
4
5namespace xrpl {
6namespace test {
7
14class CaptureLogs : public Logs
15{
19
24 {
27
28 public:
30 : beast::Journal::Sink(threshold, false), strmMutex_(mutex), strm_(strm)
31 {
32 }
33
34 void
35 write(beast::severities::Severity level, std::string const& text) override
36 {
38 strm_ << text;
39 }
40
41 void
43 {
45 strm_ << text;
46 }
47 };
48
49public:
50 explicit CaptureLogs(std::string* pResult) : Logs(beast::severities::kInfo), pResult_(pResult)
51 {
52 }
53
54 ~CaptureLogs() override
55 {
56 *pResult_ = strm_.str();
57 }
58
64};
65
66} // namespace test
67} // namespace xrpl
Abstraction for the underlying message destination.
Definition Journal.h:56
virtual Severity threshold() const
Returns the minimum severity level this sink will report.
Manages partitions for logging.
Definition Log.h:32
beast::severities::Severity threshold() const
Definition Log.cpp:140
sink for writing all log messages to a stringstream
Definition CaptureLogs.h:24
void write(beast::severities::Severity level, std::string const &text) override
Write text to the sink at the specified severity.
Definition CaptureLogs.h:35
CaptureSink(beast::severities::Severity threshold, std::mutex &mutex, std::stringstream &strm)
Definition CaptureLogs.h:29
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:42
Log manager for CaptureSinks.
Definition CaptureLogs.h:15
std::stringstream strm_
Definition CaptureLogs.h:17
std::string * pResult_
Definition CaptureLogs.h:18
CaptureLogs(std::string *pResult)
Definition CaptureLogs.h:50
std::unique_ptr< beast::Journal::Sink > makeSink(std::string const &partition, beast::severities::Severity threshold) override
Definition CaptureLogs.h:60
T is_same_v
Severity
Severity level / threshold of a Journal message.
Definition Journal.h:12
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
T str(T... args)