rippled
Classes | Public Member Functions | Static Public Member Functions | Private Types | Static Private Member Functions | Private Attributes | List of all members
ripple::test::CaptureLogs Class Reference

Log manager for CaptureSinks. More...

Inheritance diagram for ripple::test::CaptureLogs:
Inheritance graph
[legend]
Collaboration diagram for ripple::test::CaptureLogs:
Collaboration graph
[legend]

Classes

class  CaptureSink
 sink for writing all log messages to a stringstream More...
 

Public Member Functions

 CaptureLogs (std::string *pResult)
 
 ~CaptureLogs () override
 
std::unique_ptr< beast::Journal::SinkmakeSink (std::string const &partition, beast::severities::Severity threshold) override
 
bool open (boost::filesystem::path const &pathToLogFile)
 
beast::Journal::Sinkget (std::string const &name)
 
beast::Journal::Sinkoperator[] (std::string const &name)
 
beast::Journal journal (std::string const &name)
 
beast::severities::Severity threshold () const
 
void threshold (beast::severities::Severity thresh)
 
std::vector< std::pair< std::string, std::string > > partition_severities () const
 
void write (beast::severities::Severity level, std::string const &partition, std::string const &text, bool console)
 
std::string rotate ()
 
void silent (bool bSilent)
 Set flag to write logs to stderr (false) or not (true). More...
 

Static Public Member Functions

static LogSeverity fromSeverity (beast::severities::Severity level)
 
static beast::severities::Severity toSeverity (LogSeverity level)
 
static std::string toString (LogSeverity s)
 
static LogSeverity fromString (std::string const &s)
 

Private Types

enum  { maximumMessageCharacters = 12 * 1024 }
 

Static Private Member Functions

static void format (std::string &output, std::string const &message, beast::severities::Severity severity, std::string const &partition)
 

Private Attributes

std::mutex strmMutex_
 
std::stringstream strm_
 
std::stringpResult_
 
std::mutex mutex_
 
std::map< std::string, std::unique_ptr< beast::Journal::Sink >, boost::beast::iless > sinks_
 
beast::severities::Severity thresh_
 
File file_
 
bool silent_ = false
 

Detailed Description

Log manager for CaptureSinks.

This class holds the stream instance that is written to by the sinks. Upon destruction, all contents of the stream are assigned to the string specified in the ctor

Definition at line 31 of file CaptureLogs.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
privateinherited
Enumerator
maximumMessageCharacters 

Definition at line 234 of file Log.h.

Constructor & Destructor Documentation

◆ CaptureLogs()

ripple::test::CaptureLogs::CaptureLogs ( std::string pResult)
explicit

Definition at line 66 of file CaptureLogs.h.

◆ ~CaptureLogs()

ripple::test::CaptureLogs::~CaptureLogs ( )
override

Definition at line 71 of file CaptureLogs.h.

Member Function Documentation

◆ makeSink()

std::unique_ptr<beast::Journal::Sink> ripple::test::CaptureLogs::makeSink ( std::string const &  partition,
beast::severities::Severity  threshold 
)
overridevirtual

Reimplemented from ripple::Logs.

Definition at line 77 of file CaptureLogs.h.

◆ open()

bool ripple::Logs::open ( boost::filesystem::path const &  pathToLogFile)
inherited

Definition at line 124 of file Log.cpp.

◆ get()

beast::Journal::Sink & ripple::Logs::get ( std::string const &  name)
inherited

Definition at line 130 of file Log.cpp.

◆ operator[]()

beast::Journal::Sink & ripple::Logs::operator[] ( std::string const &  name)
inherited

Definition at line 138 of file Log.cpp.

◆ journal()

beast::Journal ripple::Logs::journal ( std::string const &  name)
inherited

Definition at line 144 of file Log.cpp.

◆ threshold() [1/2]

beast::severities::Severity ripple::Logs::threshold ( ) const
inherited

Definition at line 150 of file Log.cpp.

◆ threshold() [2/2]

void ripple::Logs::threshold ( beast::severities::Severity  thresh)
inherited

Definition at line 156 of file Log.cpp.

◆ partition_severities()

std::vector< std::pair< std::string, std::string > > ripple::Logs::partition_severities ( ) const
inherited

Definition at line 165 of file Log.cpp.

◆ write()

void ripple::Logs::write ( beast::severities::Severity  level,
std::string const &  partition,
std::string const &  text,
bool  console 
)
inherited

Definition at line 176 of file Log.cpp.

◆ rotate()

std::string ripple::Logs::rotate ( )
inherited

Definition at line 194 of file Log.cpp.

◆ silent()

void ripple::Logs::silent ( bool  bSilent)
inherited

Set flag to write logs to stderr (false) or not (true).

Parameters
bSilentSet flag accordingly.

Definition at line 210 of file Log.h.

◆ fromSeverity()

LogSeverity ripple::Logs::fromSeverity ( beast::severities::Severity  level)
staticinherited

Definition at line 210 of file Log.cpp.

◆ toSeverity()

beast::severities::Severity ripple::Logs::toSeverity ( LogSeverity  level)
staticinherited

Definition at line 237 of file Log.cpp.

◆ toString()

std::string ripple::Logs::toString ( LogSeverity  s)
staticinherited

Definition at line 263 of file Log.cpp.

◆ fromString()

LogSeverity ripple::Logs::fromString ( std::string const &  s)
staticinherited

Definition at line 286 of file Log.cpp.

◆ format()

void ripple::Logs::format ( std::string output,
std::string const &  message,
beast::severities::Severity  severity,
std::string const &  partition 
)
staticprivateinherited

Definition at line 311 of file Log.cpp.

Member Data Documentation

◆ strmMutex_

std::mutex ripple::test::CaptureLogs::strmMutex_
private

Definition at line 33 of file CaptureLogs.h.

◆ strm_

std::stringstream ripple::test::CaptureLogs::strm_
private

Definition at line 34 of file CaptureLogs.h.

◆ pResult_

std::string* ripple::test::CaptureLogs::pResult_
private

Definition at line 35 of file CaptureLogs.h.

◆ mutex_

std::mutex ripple::Logs::mutex_
mutableprivateinherited

Definition at line 154 of file Log.h.

◆ sinks_

std::map< std::string, std::unique_ptr<beast::Journal::Sink>, boost::beast::iless> ripple::Logs::sinks_
privateinherited

Definition at line 159 of file Log.h.

◆ thresh_

beast::severities::Severity ripple::Logs::thresh_
privateinherited

Definition at line 160 of file Log.h.

◆ file_

File ripple::Logs::file_
privateinherited

Definition at line 161 of file Log.h.

◆ silent_

bool ripple::Logs::silent_ = false
privateinherited

Definition at line 162 of file Log.h.