C++ Utils  0.1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines
Classes | Public Types | Public Member Functions | Related Functions
utils::Logger Class Reference

#include <logger.h>

List of all members.

Classes

struct  Stream

Public Types

enum  DebugType { DEBUG, INFO, WARNING, ERROR }

Public Member Functions

 Logger (DebugType t, int rank)
 Logger (const Logger &o)
 ~Logger ()
Loggeroperator= (const Logger &other)
Loggerspace ()
Loggernospace ()
LoggermaybeSpace ()
template<typename T >
Loggeroperator<< (T t)
Loggeroperator<< (const std::string &t)
Loggeroperator<< (std::string &t)
Loggeroperator<< (std::ostream &(*func)(std::ostream &))
Loggeroperator<< (Logger &(*func)(Logger &))

Related Functions

(Note that these are not member functions.)

Loggerspace (Logger &logger)
Loggernospace (Logger &logger)
template<typename T >
Loggeroperator<< (Logger debug, const std::vector< T > &list)
utils::Logger logError ()
utils::Logger logWarning (int rank=0)
utils::Logger logInfo (int rank=0)
utils::Logger logDebug (int rank=0)

Detailed Description

Handles debugging/logging output

Most of the code is taken form QDebug form the Qt Framework


Member Enumeration Documentation

Message type

Enumerator:
DEBUG 

A debug messages

INFO 

A info message (printed to stdout)

WARNING 

A warning message

ERROR 

A fatal error


Constructor & Destructor Documentation

utils::Logger::Logger ( DebugType  t,
int  rank 
) [inline]

Pointer to all information about the message Start a new Debug message

Parameters:
tType of the message
rankRank of the current process, only messages form rank 0 will be printed
utils::Logger::Logger ( const Logger o) [inline]

Copy constructor

utils::Logger::~Logger ( ) [inline]

Member Function Documentation

Add space of activated

Deactivate spaces

template<typename T >
Logger& utils::Logger::operator<< ( t) [inline]

Default function to add messages

Logger& utils::Logger::operator<< ( const std::string &  t) [inline]

Add a string variable to the message

Logger& utils::Logger::operator<< ( std::string &  t) [inline]

Add a string variable to the message

Logger& utils::Logger::operator<< ( std::ostream &(*)(std::ostream &)  func) [inline]

Operator to add functions like std::endl

Logger& utils::Logger::operator<< ( Logger &(*)(Logger &)  func) [inline]

Operator for enabling/disabling automatic spacing

Logger& utils::Logger::operator= ( const Logger other) [inline]

Copy operator

Add a space to output message and activate spaces


Friends And Related Function Documentation

utils::Logger logDebug ( int  rank = 0) [related]

Create a debug message if enabled

utils::Logger logError ( ) [related]

Create error message and exit

utils::Logger logInfo ( int  rank = 0) [related]

Create a info message if enabled

utils::Logger logWarning ( int  rank = 0) [related]

Create a warning message if enabled

Logger & nospace ( Logger logger) [related]

Function to deactivate automatic spacing

See also:
space()
template<typename T >
Logger & operator<< ( Logger  debug,
const std::vector< T > &  list 
) [related]

Add a std::vector<T> to the message

Logger & space ( Logger logger) [related]

Function to activate automatic spacing

Example: logInfo() << nospace() << x << ":";


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines