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

A generic endpoint for log messages. More...

Collaboration diagram for beast::Journal:
Collaboration graph
[legend]

Classes

class  ScopedStream
 
class  Sink
 Abstraction for the underlying message destination. More...
 
class  Stream
 Provide a light-weight way to check active() before string formatting. More...
 

Public Member Functions

 Journal ()=delete
 Journal has no default constructor. More...
 
 Journal (Sink &sink)
 Create a journal that writes to the specified sink. More...
 
Sinksink () const
 Returns the Sink associated with this Journal. More...
 
Stream stream (Severity level) const
 Returns a stream for this sink, with the specified severity level. More...
 
bool active (Severity level) const
 Returns true if any message would be logged at this severity level. More...
 
Stream trace () const
 Severity stream access functions. More...
 
Stream debug () const
 
Stream info () const
 
Stream warn () const
 
Stream error () const
 
Stream fatal () const
 

Static Public Member Functions

static SinkgetNullSink ()
 Returns a Sink which does nothing. More...
 

Private Types

using Severity = severities::Severity
 

Private Attributes

Sinkm_sink
 

Detailed Description

A generic endpoint for log messages.

The Journal has a few simple goals:

To be light-weight and copied by value. To allow logging statements to be left in source code. The logging is controlled at run-time based on a logging threshold.

It is advisable to check Journal::active(level) prior to formatting log text. Doing so sidesteps expensive text formatting when the results will not be sent to the log.

Definition at line 58 of file Journal.h.

Member Typedef Documentation

◆ Severity

Definition at line 65 of file Journal.h.

Constructor & Destructor Documentation

◆ Journal() [1/2]

beast::Journal::Journal ( )
delete

Journal has no default constructor.

◆ Journal() [2/2]

beast::Journal::Journal ( Sink sink)
explicit

Create a journal that writes to the specified sink.

Definition at line 278 of file Journal.h.

Member Function Documentation

◆ getNullSink()

Journal::Sink & beast::Journal::getNullSink ( )
static

Returns a Sink which does nothing.

Definition at line 72 of file beast_Journal.cpp.

◆ sink()

Sink& beast::Journal::sink ( ) const

Returns the Sink associated with this Journal.

Definition at line 284 of file Journal.h.

◆ stream()

Stream beast::Journal::stream ( Severity  level) const

Returns a stream for this sink, with the specified severity level.

Definition at line 291 of file Journal.h.

◆ active()

bool beast::Journal::active ( Severity  level) const

Returns true if any message would be logged at this severity level.

For a message to be logged, the severity must be at or above the sink's severity threshold.

Definition at line 301 of file Journal.h.

◆ trace()

Stream beast::Journal::trace ( ) const

Severity stream access functions.

Definition at line 309 of file Journal.h.

◆ debug()

Stream beast::Journal::debug ( ) const

Definition at line 315 of file Journal.h.

◆ info()

Stream beast::Journal::info ( ) const

Definition at line 321 of file Journal.h.

◆ warn()

Stream beast::Journal::warn ( ) const

Definition at line 327 of file Journal.h.

◆ error()

Stream beast::Journal::error ( ) const

Definition at line 333 of file Journal.h.

◆ fatal()

Stream beast::Journal::fatal ( ) const

Definition at line 339 of file Journal.h.

Member Data Documentation

◆ m_sink

Sink* beast::Journal::m_sink
private

Definition at line 68 of file Journal.h.