20#ifndef RIPPLE_BASICS_LOG_H_INCLUDED
21#define RIPPLE_BASICS_LOG_H_INCLUDED
23#include <xrpl/basics/UnorderedContainers.h>
24#include <xrpl/beast/utility/Journal.h>
26#include <boost/beast/core/string.hpp>
27#include <boost/filesystem.hpp>
116 open(
boost::filesystem::path const& path);
133 write(
char const* text);
181 open(boost::filesystem::path
const& pathToLogFile);
Abstraction for the underlying message destination.
A generic endpoint for log messages.
Manages a system file containing logged output.
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...
std::unique_ptr< std::ofstream > m_stream
void writeln(std::string const &str)
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.
boost::filesystem::path m_path
File()
Construct with no associated system file.
~File()=default
Destroy the object.
void write(beast::severities::Severity level, std::string const &text) override
Write text to the sink at the specified severity.
Sink & operator=(Sink const &)=delete
void writeAlways(beast::severities::Severity level, std::string const &text) override
Bypass filter and write text to the sink at the specified severity.
Sink(Sink const &)=delete
Manages partitions for logging.
void silent(bool bSilent)
Set flag to write logs to stderr (false) or not (true).
beast::Journal::Sink & get(std::string const &name)
beast::severities::Severity thresh_
static LogSeverity fromString(std::string const &s)
Logs(Logs const &)=delete
void write(beast::severities::Severity level, std::string const &partition, std::string const &text, bool console)
Logs & operator=(Logs const &)=delete
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)
std::vector< std::pair< std::string, std::string > > partition_severities() const
beast::Journal::Sink & operator[](std::string const &name)
@ maximumMessageCharacters
static LogSeverity fromSeverity(beast::severities::Severity level)
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::unique_ptr< beast::Journal::Sink > setDebugLogSink(std::unique_ptr< beast::Journal::Sink > sink)
Set the sink for the debug journal.