IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Abstract class for log classes. More...

#include <logger.hpp>

Inheritance diagram for QExtend::ILog:
QExtend::LogFile QExtend::LogListWidget QExtend::LogStdout QExtend::LogTextBrowser

List of all members.

Public Slots

virtual void writeLog (LoggerType type, QString message, QString location)=0
 Virtual function to write on the log support.
virtual void cleanLog ()=0
 Virtual function to clean the log support.

Public Member Functions

void setLogFormat (QString logFormat)
 Define log string format.
void setDateFormat (QString dateFormat)
 Define date string format.
void setTypeName (LoggerType type, QString name)
 Define log type name.
const QString & getLogFormat ()
 Get log string format.
const QString & getDateFormat ()
 Get date string format.
const QString & getTypeName (LoggerType type)
 Get log type name for a given type.

Protected Member Functions

QString createLogMessage (LoggerType type, QString message, QString location)
 Create the log message string.
void initLogAttributes ()
 Initialize ILog attributes.

Protected Attributes

QString m_logFormat
 String containing the position of the 4 log arguments.
QString m_dateFormat
 String containing the date format as QDateTime::toString().
QStringList m_typesNames
 String list containing the types names for LoggerType.

Detailed Description

Abstract class for log classes.

ILog is an abstract class which need to be herite by log classes. It own several common attributes and methods to handle log classes.

Definition at line 66 of file logger.hpp.


Member Function Documentation

virtual void QExtend::ILog::cleanLog (  )  [pure virtual, slot]

Virtual function to clean the log support.

This function need to be reimplemented in ILog subclasses.

Implemented in QExtend::LogFile, QExtend::LogStdout, QExtend::LogTextBrowser, and QExtend::LogListWidget.

QString QExtend::ILog::createLogMessage ( LoggerType  type,
QString  message,
QString  location 
) [protected]

Create the log message string.

Create the log message string using m_logFormat and 4 arguments. The first argument is the result of QDateTime::currentDateTime() using m_dateFormat. The three others arguments are the 3 parameters of the function in order.

Parameters:
type Type of the Log
message String containing the message
location String containing the file name and the line number where the log function is call.
Returns:
return the log message with the given format
const QString& QExtend::ILog::getDateFormat (  ) 

Get date string format.

Returns:
return date string format
const QString& QExtend::ILog::getLogFormat (  ) 

Get log string format.

Returns:
return log string format
const QString& QExtend::ILog::getTypeName ( LoggerType  type  ) 

Get log type name for a given type.

Parameters:
type Type of the Log
Returns:
return type name
void QExtend::ILog::initLogAttributes (  )  [protected]

Initialize ILog attributes.

Initialize logFormat, dateFormat and typesNames define in ILog abstract class.

void QExtend::ILog::setDateFormat ( QString  dateFormat  ) 

Define date string format.

Date string format is the same as QDateTime::toString().

Parameters:
dateFormat Date string format
void QExtend::ILog::setLogFormat ( QString  logFormat  ) 

Define log string format.

Log string format use 4 arguments preceded by %. 1 is the date formated using setDateFormat(). 2 is the type name formated using setTypeName(). 3 is the log message. 4 is the location where the log function is call "FILE:LIGNE". The default log string format is "%1 %2 %3 (%4)".

Parameters:
logFormat Log string format
void QExtend::ILog::setTypeName ( LoggerType  type,
QString  name 
)

Define log type name.

Parameters:
type Type of the Log
name Name of the type
virtual void QExtend::ILog::writeLog ( LoggerType  type,
QString  message,
QString  location 
) [pure virtual, slot]

Virtual function to write on the log support.

This function need to be reimplemented in ILog subclasses.

Parameters:
type Type of the Log
message String containing the message
location String containing the file name and the line number where the log function is call.

Implemented in QExtend::LogFile, QExtend::LogStdout, QExtend::LogTextBrowser, and QExtend::LogListWidget.


Member Data Documentation

QString QExtend::ILog::m_dateFormat [protected]

String containing the date format as QDateTime::toString().

Definition at line 72 of file logger.hpp.

QString QExtend::ILog::m_logFormat [protected]

String containing the position of the 4 log arguments.

Definition at line 70 of file logger.hpp.

QStringList QExtend::ILog::m_typesNames [protected]

String list containing the types names for LoggerType.

Definition at line 74 of file logger.hpp.

Responsable bénévole de la rubrique Qt : Thibaut Cuvelier -