xrpld
Loading...
Searching...
No Matches
beast::Journal Class Reference

A generic endpoint for log messages. More...

#include <Journal.h>

Collaboration diagram for beast::Journal:

Classes

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

Public Member Functions

 Journal ()=delete
 Journal has no default constructor.
 Journal (Sink &sink)
 Create a journal that writes to the specified sink.
Sinksink () const
 Returns the Sink associated with this Journal.
Stream stream (Severity level) const
 Returns a stream for this sink, with the specified severity level.
bool active (Severity level) const
 Returns true if any message would be logged at this severity level.
Stream trace () const
 Severity stream access functions.
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.

Private Attributes

Sinksink_

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 37 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 260 of file Journal.h.

Member Function Documentation

◆ getNullSink()

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

Returns a Sink which does nothing.

Definition at line 63 of file beast_Journal.cpp.

◆ sink()

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

Returns the Sink associated with this Journal.

Definition at line 266 of file Journal.h.

◆ stream()

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

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

Definition at line 273 of file Journal.h.

◆ active()

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

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 283 of file Journal.h.

◆ trace()

Stream beast::Journal::trace ( ) const
nodiscard

Severity stream access functions.

Definition at line 291 of file Journal.h.

◆ debug()

Stream beast::Journal::debug ( ) const
nodiscard

Definition at line 297 of file Journal.h.

◆ info()

Stream beast::Journal::info ( ) const
nodiscard

Definition at line 303 of file Journal.h.

◆ warn()

Stream beast::Journal::warn ( ) const
nodiscard

Definition at line 309 of file Journal.h.

◆ error()

Stream beast::Journal::error ( ) const
nodiscard

Definition at line 315 of file Journal.h.

◆ fatal()

Stream beast::Journal::fatal ( ) const
nodiscard

Definition at line 321 of file Journal.h.

Member Data Documentation

◆ sink_

Sink* beast::Journal::sink_
private

Definition at line 44 of file Journal.h.