E-MailRelay
Public Types | Public Member Functions | Static Public Member Functions | List of all members
G::Log Class Reference

A class for doing iostream-based logging. More...

#include <glog.h>

Public Types

enum class  Severity {
  s_InfoVerbose , s_InfoSummary , s_Debug , s_Warning ,
  s_Error , s_Assertion
}
 

Public Member Functions

 Log (Severity, const char *file, int line)
 Constructor. More...
 
 ~Log ()
 Destructor. Writes the accumulated string to the log output. More...
 
std::ostream & operator<< (const char *s)
 Streams 's' and then returns a stream for streaming more stuff into. More...
 
std::ostream & operator<< (const std::string &s)
 Streams 's' and then returns a stream for streaming more stuff into. More...
 
 Log (const Log &)=delete
 
 Log (Log &&)=delete
 
void operator= (const Log &)=delete
 
void operator= (Log &&)=delete
 

Static Public Member Functions

static bool at (Severity)
 Returns true if G::LogOutput::output() would log at the given level. More...
 
static bool at (Severity, const char *group)
 An overload that adds a logging group name to the test.
 

Detailed Description

A class for doing iostream-based logging.

The G_LOG/G_DEBUG/G_WARNING/G_ERROR macros are provided as a convenient way of using this interface.

Usage:

G::Log(G::Log::Severity::s_InfoSummary,__FILE__,__LINE__) << a << b ;
A class for doing iostream-based logging.
Definition: glog.h:49

or

G_LOG( a << b ) ;
See also
G::LogOutput

Definition at line 48 of file glog.h.

Member Enumeration Documentation

◆ Severity

enum class G::Log::Severity
strong

Definition at line 51 of file glog.h.

Constructor & Destructor Documentation

◆ Log()

G::Log::Log ( Severity  severity,
const char *  file,
int  line 
)

Constructor.

Definition at line 25 of file glog.cpp.

◆ ~Log()

G::Log::~Log ( )

Destructor. Writes the accumulated string to the log output.

Definition at line 33 of file glog.cpp.

Member Function Documentation

◆ at()

bool G::Log::at ( Severity  s)
static

Returns true if G::LogOutput::output() would log at the given level.

This can be used as an optimisation to short-ciruit the stream-out expression evaluation.

Definition at line 44 of file glog.cpp.

◆ operator<<() [1/2]

std::ostream & G::Log::operator<< ( const char *  s)

Streams 's' and then returns a stream for streaming more stuff into.

Definition at line 50 of file glog.cpp.

◆ operator<<() [2/2]

std::ostream & G::Log::operator<< ( const std::string &  s)

Streams 's' and then returns a stream for streaming more stuff into.

Definition at line 56 of file glog.cpp.


The documentation for this class was generated from the following files: