Peano
Loading...
Searching...
No Matches
tarch::logging::NoLogger Class Reference

Command Line Logger. More...

#include <NoLogger.h>

Collaboration diagram for tarch::logging::NoLogger:

Public Member Functions

 ~NoLogger ()=default
 
void debug (long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
 Nop.
 
void info (long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
 
void warning (long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
 Write Warning.
 
void error (long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
 Write Error.
 
void traceIn (long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
 Nop.
 
void traceOut (long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
 Nop.
 
void indent (bool indent, const std::string &trace)
 Nop.
 
void setQuitOnError (bool value)
 

Static Public Member Functions

static NoLogger & getInstance ()
 

Private Member Functions

NoLogger & operator= (const NoLogger &)=delete
 Declared private since assignment does not make sense for an output class (output information mismatch).
 
 NoLogger (const NoLogger &)=delete
 Declared private since copying does not make sense for an output class (output information mismatch).
 
 NoLogger ()
 It's a singleton.
 
std::string constructMessageString (std::string messageType, long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
 

Private Attributes

tarch::multicore::BooleanSemaphore _semaphore
 
bool _quitOnError
 

Static Private Attributes

static Log _log
 
static NoLogger _singleton
 

Detailed Description

Command Line Logger.

Standard log output device. Implements the LogHandle. Usually there's only one instance of this class for only the Log type aggregates it in a static way. For a detailed description of this compiler flags please browse through the static consts of the class or the howto page.

An interesting issue is the behaviour of the command line logger in the parallel mode if debug is switched on. In this case the number of messages soon becomes unreadable for any human. Thus, the command line logger internally creates one output file rank.log for each rank and writes all the information into this file. info, warnings and errors are written (in short form) to std::cout / std::cerr, too.

If the debug mode is not set, all information is written to std::cout.

Note, that if multithreading is switched on (TBB-flag), the access to std::cout or the logfile respectively is synchronized. The other methods are not thread-safe and should be called only in safe context for defined behaviour.

Version
Revision
1.19
Author
Tobias Weinzierl, Wolfgang Eckhardt

Definition at line 48 of file NoLogger.h.

Constructor & Destructor Documentation

◆ NoLogger() [1/2]

tarch::logging::NoLogger::NoLogger ( const NoLogger &  )
privatedelete

Declared private since copying does not make sense for an output class (output information mismatch).

◆ NoLogger() [2/2]

tarch::logging::NoLogger::NoLogger ( )
private

It's a singleton.

◆ ~NoLogger()

tarch::logging::NoLogger::~NoLogger ( )
default

Member Function Documentation

◆ constructMessageString()

std::string tarch::logging::NoLogger::constructMessageString ( std::string  messageType,
long int  timestampNanoseconds,
int  rank,
int  threadId,
const std::string &  trace,
const std::string &  message 
)
private

◆ debug()

void tarch::logging::NoLogger::debug ( long int  timestampNanoseconds,
int  rank,
int  threadId,
const std::string &  trace,
const std::string &  message 
)

Nop.

◆ error()

void tarch::logging::NoLogger::error ( long int  timestampNanoseconds,
int  rank,
int  threadId,
const std::string &  trace,
const std::string &  message 
)

Write Error.

In the implementation, I call a flush on cout before I write to cerr. Otherwise, the cerr messages might overtake cout. Before the operation returns, it does a flush on cerr, too. Otherwise, the message might not occur, i.e. the application might shut down before the message is flushed to the terminal.

◆ getInstance()

static NoLogger & tarch::logging::NoLogger::getInstance ( )
static

◆ indent()

void tarch::logging::NoLogger::indent ( bool  indent,
const std::string &  trace 
)

Nop.

Definition at line 126 of file NoLogger.h.

◆ info()

void tarch::logging::NoLogger::info ( long int  timestampNanoseconds,
int  rank,
int  threadId,
const std::string &  trace,
const std::string &  message 
)

◆ operator=()

NoLogger & tarch::logging::NoLogger::operator= ( const NoLogger &  )
privatedelete

Declared private since assignment does not make sense for an output class (output information mismatch).

◆ setQuitOnError()

void tarch::logging::NoLogger::setQuitOnError ( bool  value)

◆ traceIn()

void tarch::logging::NoLogger::traceIn ( long int  timestampNanoseconds,
int  rank,
int  threadId,
const std::string &  trace,
const std::string &  message 
)

Nop.

Definition at line 116 of file NoLogger.h.

◆ traceOut()

void tarch::logging::NoLogger::traceOut ( long int  timestampNanoseconds,
int  rank,
int  threadId,
const std::string &  trace,
const std::string &  message 
)

Nop.

Definition at line 121 of file NoLogger.h.

◆ warning()

void tarch::logging::NoLogger::warning ( long int  timestampNanoseconds,
int  rank,
int  threadId,
const std::string &  trace,
const std::string &  message 
)

Write Warning.

In the implementation, I call a flush on cout before I write to cerr. Otherwise, the cerr messages might overtake cout. Before the operation returns, it does a flush on cerr, too. Otherwise, the message might not occur, i.e. the application might shut down before the message is flushed to the terminal.

Field Documentation

◆ _log

Log tarch::logging::NoLogger::_log
staticprivate

Definition at line 50 of file NoLogger.h.

◆ _quitOnError

bool tarch::logging::NoLogger::_quitOnError
private

Definition at line 56 of file NoLogger.h.

◆ _semaphore

tarch::multicore::BooleanSemaphore tarch::logging::NoLogger::_semaphore
private

Definition at line 54 of file NoLogger.h.

◆ _singleton

NoLogger tarch::logging::NoLogger::_singleton
staticprivate

Definition at line 52 of file NoLogger.h.


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