votca 2024.2-dev
Loading...
Searching...
No Matches
votca::xtp::Logger Class Referencefinal

Logger is used for thread-safe output of messages. More...

#include <logger.h>

Inheritance diagram for votca::xtp::Logger:
Collaboration diagram for votca::xtp::Logger:

Public Member Functions

 Logger ()
 
 Logger (Log::Level ReportLevel)
 
Loggeroperator() (Log::Level LogLevel)
 
void setReportLevel (Log::Level ReportLevel)
 
void setMultithreading (bool maverick)
 
bool isMaverick () const
 
Log::Level getReportLevel () const
 
void setPreface (Log::Level level, const std::string &preface)
 
void setCommonPreface (const std::string &preface)
 
void EnablePreface ()
 
void DisablePreface ()
 

Private Member Functions

std::string Messages ()
 

Private Attributes

LogBuffer buffer_
 
Log::Level ReportLevel_ = Log::error
 
bool maverick_ = false
 

Friends

std::ostream & operator<< (std::ostream &log_out, Logger &logger)
 

Detailed Description

Logger is used for thread-safe output of messages.

Logger writes messages into LogBuffer. Inheritance from ostream allows to use overloaded << and >> for writing. Example:

#include <logger.h>
Logger log; // create a logger object
log.setReportLevel(Log::error); // output only log messages starting from a
level XTP_LOG(Log::error,*log) << "Error detected" << flush; // write to
the logger at an ERROR level cout << log; // output logger content to
standard output
Logger is used for thread-safe output of messages.
Definition logger.h:164
void setReportLevel(Log::Level ReportLevel)
Definition logger.h:185
#define XTP_LOG(level, log)
Definition logger.h:40

Logger has four predefined log levels: error, warning, info, debug.

Definition at line 164 of file logger.h.

Constructor & Destructor Documentation

◆ Logger() [1/2]

votca::xtp::Logger::Logger ( )
inline

Definition at line 172 of file logger.h.

◆ Logger() [2/2]

votca::xtp::Logger::Logger ( Log::Level ReportLevel)
inline

Definition at line 175 of file logger.h.

Member Function Documentation

◆ DisablePreface()

void votca::xtp::Logger::DisablePreface ( )
inline

Definition at line 207 of file logger.h.

◆ EnablePreface()

void votca::xtp::Logger::EnablePreface ( )
inline

Definition at line 205 of file logger.h.

◆ getReportLevel()

Log::Level votca::xtp::Logger::getReportLevel ( ) const
inline

Definition at line 192 of file logger.h.

◆ isMaverick()

bool votca::xtp::Logger::isMaverick ( ) const
inline

Definition at line 190 of file logger.h.

◆ Messages()

std::string votca::xtp::Logger::Messages ( )
inlineprivate

Definition at line 217 of file logger.h.

◆ operator()()

Logger & votca::xtp::Logger::operator() ( Log::Level LogLevel)
inline

Definition at line 180 of file logger.h.

◆ setCommonPreface()

void votca::xtp::Logger::setCommonPreface ( const std::string & preface)
inline

Definition at line 198 of file logger.h.

◆ setMultithreading()

void votca::xtp::Logger::setMultithreading ( bool maverick)
inline

Definition at line 186 of file logger.h.

◆ setPreface()

void votca::xtp::Logger::setPreface ( Log::Level level,
const std::string & preface )
inline

Definition at line 194 of file logger.h.

◆ setReportLevel()

void votca::xtp::Logger::setReportLevel ( Log::Level ReportLevel)
inline

Definition at line 185 of file logger.h.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & log_out,
Logger & logger )
friend

Definition at line 166 of file logger.h.

Member Data Documentation

◆ buffer_

LogBuffer votca::xtp::Logger::buffer_
private

Definition at line 210 of file logger.h.

◆ maverick_

bool votca::xtp::Logger::maverick_ = false
private

Definition at line 215 of file logger.h.

◆ ReportLevel_

Log::Level votca::xtp::Logger::ReportLevel_ = Log::error
private

Definition at line 212 of file logger.h.


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