FougTools  0.7.0dev-046fb6a
Handy tools for C++, Qt and OpenCascade
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Related Functions | List of all members
qtcore::Log Class Reference

Provides an easy-to-use output stream for logging. More...

#include <qttools/core/log.h>

Public Types

enum  MessageType {
  DebugMessage, InfoMessage, WarningMessage, CriticalMessage,
  FatalMessage
}
 Types of logging message, with increasing severity. More...
 

Public Member Functions

 Log ()
 Construct a null Log stream, ie. it won't print anything. More...
 
 Log (MessageType msgType)
 Construct a Log stream for messages of a special type. More...
 
 Log (const Log &other)
 Construct a copy of the other Log stream. More...
 
 ~Log ()
 Flush any pending data to be written and destroys the Log stream. More...
 
Logspace ()
 Write a space character to the Log stream and return a reference to the stream. More...
 
Logoperator<< (bool)
 Write the boolean t to the log stream and return a reference to the stream. More...
 
Logoperator<< (char)
 
Logoperator<< (short)
 
Logoperator<< (unsigned short)
 
Logoperator<< (int)
 
Logoperator<< (unsigned int)
 
Logoperator<< (long)
 
Logoperator<< (unsigned long)
 
Logoperator<< (qlonglong)
 
Logoperator<< (qulonglong)
 
Logoperator<< (float)
 
Logoperator<< (double)
 
Logoperator<< (const char *)
 
Logoperator<< (const QString &)
 
template<typename T >
Logoperator<< (const T *ptr)
 

Static Public Member Functions

static void registerMetaTypes ()
 

Related Functions

(Note that these are not member functions.)

Log debugLog ()
 
Log infoLog ()
 
Log warningLog ()
 
Log criticalLog ()
 
Log fatalLog ()
 
void attachGlobalLogHandler (AbstractLogHandler *handler)
 Append handler to the global list of log handlers. More...
 
void detachGlobalLogHandler (AbstractLogHandler *handler)
 Remove handler from the global list of log handlers. More...
 

Detailed Description

Provides an easy-to-use output stream for logging.

This class is almost a clone of QDebug, but it's focused on logging.
Also the way messages are handled is different as there can be multiple logging handlers attached (not just one).

Member Enumeration Documentation

Types of logging message, with increasing severity.

Enumerator
DebugMessage 
InfoMessage 
WarningMessage 
CriticalMessage 
FatalMessage 

Constructor & Destructor Documentation

qtcore::Log::Log ( )

Construct a null Log stream, ie. it won't print anything.

qtcore::Log::Log ( MessageType  msgType)

Construct a Log stream for messages of a special type.

qtcore::Log::Log ( const Log other)

Construct a copy of the other Log stream.

qtcore::Log::~Log ( )

Flush any pending data to be written and destroys the Log stream.

Member Function Documentation

Log & qtcore::Log::operator<< ( bool  t)

Write the boolean t to the log stream and return a reference to the stream.

Log & qtcore::Log::operator<< ( char  t)
Log & qtcore::Log::operator<< ( short  t)
Log & qtcore::Log::operator<< ( unsigned short  t)
Log & qtcore::Log::operator<< ( int  t)
Log & qtcore::Log::operator<< ( unsigned int  t)
Log & qtcore::Log::operator<< ( long  t)
Log & qtcore::Log::operator<< ( unsigned long  t)
Log & qtcore::Log::operator<< ( qlonglong  t)
Log & qtcore::Log::operator<< ( qulonglong  t)
Log & qtcore::Log::operator<< ( float  t)
Log & qtcore::Log::operator<< ( double  t)
Log & qtcore::Log::operator<< ( const char *  str)
Log & qtcore::Log::operator<< ( const QString &  str)
template<typename T >
Log & qtcore::Log::operator<< ( const T *  ptr)
void qtcore::Log::registerMetaTypes ( )
static
Log & qtcore::Log::space ( )

Write a space character to the Log stream and return a reference to the stream.

Friends And Related Function Documentation

void attachGlobalLogHandler ( AbstractLogHandler handler)
related

Append handler to the global list of log handlers.

If the internal list of log handlers is empty then all pending log messages are flushed to handler.

Note that log messages are recorded when there is no log handler attached. In this case a log message is considered as "pending".

Log criticalLog ( )
related
Log debugLog ( )
related
void detachGlobalLogHandler ( AbstractLogHandler handler)
related

Remove handler from the global list of log handlers.

Log fatalLog ( )
related
Log infoLog ( )
related
Log warningLog ( )
related

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