20 #ifndef RIPPLE_BASICS_LOG_H_INCLUDED
21 #define RIPPLE_BASICS_LOG_H_INCLUDED
23 #include <ripple/basics/UnorderedContainers.h>
24 #include <ripple/beast/utility/Journal.h>
25 #include <boost/beast/core/string.hpp>
26 #include <boost/filesystem.hpp>
109 open(boost::filesystem::path
const& path);
126 write(
char const* text);
171 virtual ~Logs() =
default;
174 open(boost::filesystem::path
const& pathToLogFile);
Abstraction for the underlying message destination.
std::vector< std::pair< std::string, std::string > > partition_severities() const
beast::severities::Severity thresh_
void close()
Close the system file if it is open.
Manages partitions for logging.
void writeln(char const *text)
write to the log file and append an end of line marker.
void write(char const *text)
write to the log file.
std::unique_ptr< std::ofstream > m_stream
File()
Construct with no associated system file.
beast::Journal::Sink & operator[](std::string const &name)
void write(beast::severities::Severity level, std::string const &text) override
Write text to the sink at the specified severity.
bool closeAndReopen()
Close and re-open the system file associated with the log This assists in interoperating with externa...
beast::Journal debugLog()
Returns a debug journal.
static std::string toString(LogSeverity s)
static LogSeverity fromSeverity(beast::severities::Severity level)
Logs & operator=(Logs const &)=delete
void write(std::string const &str)
Write to the log file using std::string.
std::unique_ptr< beast::Journal::Sink > setDebugLogSink(std::unique_ptr< beast::Journal::Sink > sink)
Set the sink for the debug journal.
Manages a system file containing logged output.
bool isOpen() const noexcept
Determine if a system file is associated with the log.
bool open(boost::filesystem::path const &path)
Associate a system file with the log.
static LogSeverity fromString(std::string const &s)
void writeln(std::string const &str)
A generic endpoint for log messages.
Logs(beast::severities::Severity level)
~File()=default
Destroy the object.
void silent(bool bSilent)
Set flag to write logs to stderr (false) or not (true).
beast::severities::Severity threshold() const
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Sink & operator=(Sink const &)=delete
beast::Journal journal(std::string const &name)
virtual std::unique_ptr< beast::Journal::Sink > makeSink(std::string const &partition, beast::severities::Severity startingLevel)
@ maximumMessageCharacters
Severity
Severity level / threshold of a Journal message.
boost::filesystem::path m_path
static beast::severities::Severity toSeverity(LogSeverity level)
std::map< std::string, std::unique_ptr< beast::Journal::Sink >, boost::beast::iless > sinks_
void write(beast::severities::Severity level, std::string const &partition, std::string const &text, bool console)
beast::Journal::Sink & get(std::string const &name)
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)