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

Manages partitions for logging. More...

Inheritance diagram for ripple::Logs:
Inheritance graph
[legend]
Collaboration diagram for ripple::Logs:
Collaboration graph
[legend]

Classes

class  File
 Manages a system file containing logged output. More...
 
class  Sink
 

Public Member Functions

 Logs (beast::severities::Severity level)
 
 Logs (Logs const &)=delete
 
Logsoperator= (Logs const &)=delete
 
virtual ~Logs ()=default
 
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...
 
virtual std::unique_ptr< beast::Journal::SinkmakeSink (std::string const &partition, beast::severities::Severity startingLevel)
 

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 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

Manages partitions for logging.

Definition at line 48 of file Log.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
maximumMessageCharacters 

Definition at line 234 of file Log.h.

Constructor & Destructor Documentation

◆ Logs() [1/2]

ripple::Logs::Logs ( beast::severities::Severity  level)

Definition at line 118 of file Log.cpp.

◆ Logs() [2/2]

ripple::Logs::Logs ( Logs const &  )
delete

◆ ~Logs()

virtual ripple::Logs::~Logs ( )
virtualdefault

Member Function Documentation

◆ operator=()

Logs& ripple::Logs::operator= ( Logs const &  )
delete

◆ open()

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

Definition at line 124 of file Log.cpp.

◆ get()

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

Definition at line 130 of file Log.cpp.

◆ operator[]()

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

Definition at line 138 of file Log.cpp.

◆ journal()

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

Definition at line 144 of file Log.cpp.

◆ threshold() [1/2]

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

Definition at line 150 of file Log.cpp.

◆ threshold() [2/2]

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

Definition at line 156 of file Log.cpp.

◆ partition_severities()

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

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 
)

Definition at line 176 of file Log.cpp.

◆ rotate()

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

Definition at line 194 of file Log.cpp.

◆ silent()

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

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

Parameters
bSilentSet flag accordingly.

Definition at line 210 of file Log.h.

◆ makeSink()

std::unique_ptr< beast::Journal::Sink > ripple::Logs::makeSink ( std::string const &  partition,
beast::severities::Severity  startingLevel 
)
virtual

◆ fromSeverity()

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

Definition at line 210 of file Log.cpp.

◆ toSeverity()

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

Definition at line 237 of file Log.cpp.

◆ toString()

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

Definition at line 263 of file Log.cpp.

◆ fromString()

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

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 
)
staticprivate

Definition at line 311 of file Log.cpp.

Member Data Documentation

◆ mutex_

std::mutex ripple::Logs::mutex_
mutableprivate

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_
private

Definition at line 159 of file Log.h.

◆ thresh_

beast::severities::Severity ripple::Logs::thresh_
private

Definition at line 160 of file Log.h.

◆ file_

File ripple::Logs::file_
private

Definition at line 161 of file Log.h.

◆ silent_

bool ripple::Logs::silent_ = false
private

Definition at line 162 of file Log.h.