20#include <xrpl/basics/Log.h> 
   21#include <xrpl/basics/chrono.h> 
   22#include <xrpl/beast/utility/Journal.h> 
   23#include <xrpl/beast/utility/instrumentation.h> 
   25#include <boost/algorithm/string/predicate.hpp> 
   26#include <boost/filesystem/path.hpp> 
   45    : 
beast::Journal::
Sink(thresh, false), logs_(logs), partition_(partition)
 
 
   55    logs_.
write(level, partition_, text, console());
 
 
   63    logs_.write(level, partition_, text, console());
 
 
   75    return m_stream != 
nullptr;
 
 
   83    bool wasOpened = 
false;
 
   93        m_stream = std::move(stream);
 
 
  118    if (m_stream != 
nullptr)
 
 
  125    if (m_stream != 
nullptr)
 
 
  150    return *result.first->second;
 
 
  177        sink.second->threshold(thresh);
 
 
  186    for (
auto const& [name, sink] : 
sinks_)
 
 
  199    format(s, text, level, partition);
 
 
  215        return "The log file was closed and reopened.";
 
  216    return "The log file could not be closed and reopened.";
 
 
  244            UNREACHABLE(
"ripple::Logs::fromSeverity : invalid severity");
 
 
  272            UNREACHABLE(
"ripple::Logs::toSeverity : invalid severity");
 
 
  301            UNREACHABLE(
"ripple::Logs::toString : invalid severity");
 
 
  310    if (boost::iequals(s, 
"trace"))
 
  313    if (boost::iequals(s, 
"debug"))
 
  316    if (boost::iequals(s, 
"info") || boost::iequals(s, 
"information"))
 
  319    if (boost::iequals(s, 
"warn") || boost::iequals(s, 
"warning") ||
 
  320        boost::iequals(s, 
"warnings"))
 
  323    if (boost::iequals(s, 
"error") || boost::iequals(s, 
"errors"))
 
  326    if (boost::iequals(s, 
"fatal") || boost::iequals(s, 
"fatals"))
 
 
  339    output.
reserve(message.
size() + partition.size() + 100);
 
  344    if (!partition.empty())
 
  345        output += partition + 
":";
 
  367            UNREACHABLE(
"ripple::Logs::format : invalid severity");
 
  386    auto scrubber = [&output](
char const* token) {
 
  387        auto first = output.
find(token);
 
  391        if (first != std::string::npos)
 
  395            if (first != std::string::npos)
 
  397                auto last = output.
find(
'\"', ++first);
 
  399                if (last == std::string::npos)
 
  400                    last = output.
size();
 
  402                output.
replace(first, last - first, last - first, 
'*');
 
  407    scrubber(
"\"seed\"");
 
  408    scrubber(
"\"seed_hex\"");
 
  409    scrubber(
"\"secret\"");
 
  410    scrubber(
"\"master_key\"");
 
  411    scrubber(
"\"master_seed\"");
 
  412    scrubber(
"\"master_seed_hex\"");
 
  413    scrubber(
"\"passphrase\"");
 
 
Abstraction for the underlying message destination.
 
A generic endpoint for log messages.
 
static Sink & getNullSink()
Returns a Sink which does nothing.
 
beast::Journal::Sink & get()
 
DebugSink(DebugSink &&)=delete
 
DebugSink(DebugSink const &)=delete
 
std::unique_ptr< beast::Journal::Sink > holder_
 
std::reference_wrapper< beast::Journal::Sink > sink_
 
DebugSink & operator=(DebugSink &&)=delete
 
DebugSink & operator=(DebugSink const &)=delete
 
std::unique_ptr< beast::Journal::Sink > set(std::unique_ptr< beast::Journal::Sink > sink)
 
bool isOpen() const noexcept
Determine if a system file is associated with the log.
 
bool closeAndReopen()
Close and re-open the system file associated with the log This assists in interoperating with externa...
 
void close()
Close the system file if it is open.
 
void write(char const *text)
write to the log file.
 
void writeln(char const *text)
write to the log file and append an end of line marker.
 
File()
Construct with no associated system file.
 
bool open(boost::filesystem::path const &path)
Associate a system file with the log.
 
void write(beast::severities::Severity level, std::string const &text) override
Write text to the sink at the specified severity.
 
void writeAlways(beast::severities::Severity level, std::string const &text) override
Bypass filter and write text to the sink at the specified severity.
 
Manages partitions for logging.
 
beast::Journal::Sink & get(std::string const &name)
 
beast::severities::Severity thresh_
 
static LogSeverity fromString(std::string const &s)
 
void write(beast::severities::Severity level, std::string const &partition, std::string const &text, bool console)
 
std::map< std::string, std::unique_ptr< beast::Journal::Sink >, boost::beast::iless > sinks_
 
beast::severities::Severity threshold() const
 
static std::string toString(LogSeverity s)
 
beast::Journal journal(std::string const &name)
 
virtual std::unique_ptr< beast::Journal::Sink > makeSink(std::string const &partition, beast::severities::Severity startingLevel)
 
static beast::severities::Severity toSeverity(LogSeverity level)
 
static void format(std::string &output, std::string const &message, beast::severities::Severity severity, std::string const &partition)
 
bool open(boost::filesystem::path const &pathToLogFile)
 
std::vector< std::pair< std::string, std::string > > partition_severities() const
 
beast::Journal::Sink & operator[](std::string const &name)
 
Logs(beast::severities::Severity level)
 
@ maximumMessageCharacters
 
static LogSeverity fromSeverity(beast::severities::Severity level)
 
T emplace_back(T... args)
 
A namespace for easy access to logging severity values.
 
Severity
Severity level / threshold of a Journal message.
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
@ open
We haven't closed our ledger yet, but others might have.
 
beast::Journal debugLog()
Returns a debug journal.
 
std::string to_string(base_uint< Bits, Tag > const &a)
 
T get(Section const §ion, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.
 
std::unique_ptr< beast::Journal::Sink > setDebugLogSink(std::unique_ptr< beast::Journal::Sink > sink)
Set the sink for the debug journal.
 
static DebugSink & debugSink()