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 ()
Logger & operator= (const Logger &other)
Logger & space ()
Logger & nospace ()
Logger & maybeSpace ()
template<typename T >
Logger & operator<< (T t)
Logger & operator<< (const std::string &t)
Logger & operator<< (std::string &t)
Logger & operator<< (std::ostream &(*func)(std::ostream &))
Logger & operator<< (Logger &(*func)(Logger &))

Related Functions

(Note that these are not member functions.)

Logger & space (Logger &logger)
Logger & nospace (Logger &logger)
template<typename T >
Logger & operator<< (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  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