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 62 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 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

Definition at line 32 of file logger.cpp.

const QString & ILog::getDateFormat (  ) 

Get date string format //!

Returns:
return date string format

Definition at line 63 of file logger.cpp.

const QString & ILog::getLogFormat (  ) 

Get log string format //!

Returns:
return log string format

Definition at line 58 of file logger.cpp.

const QString & ILog::getTypeName ( LoggerType  type  ) 

Get log type name for a given type //!

Parameters:
type Type of the Log
Returns:
return type name

Definition at line 68 of file logger.cpp.

void ILog::initLogAttributes (  )  [protected]

Initialize ILog attributes //!

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

Definition at line 73 of file logger.cpp.

void ILog::setDateFormat ( QString  dateFormat  ) 

Define date string format //!

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

Parameters:
dateFormat Date string format

Definition at line 48 of file logger.cpp.

void 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

Definition at line 43 of file logger.cpp.

void ILog::setTypeName ( LoggerType  type,
QString  name 
)

Define log type name //!

Parameters:
type Type of the Log
name Name of the type

Definition at line 53 of file logger.cpp.

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 68 of file logger.hpp.

QString QExtend::ILog::m_logFormat [protected]

String containing the position of the 4 log arguments.

Definition at line 66 of file logger.hpp.

QStringList QExtend::ILog::m_typesNames [protected]

String list containing the types names for LoggerType.

Definition at line 70 of file logger.hpp.


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

Les sources présentées sur cette page sont libres de droits et vous pouvez les utiliser à votre convenance. Par contre, la page de présentation constitue une œuvre intellectuelle protégée par les droits d'auteur. Copyright © 2010 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site ni de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon vous encourez selon la loi jusqu'à trois ans de prison et jusqu'à 300 000 € de dommages et intérêts.