Abstract class for log classes. More...
#include <logger.hpp>
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. |
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.
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.
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. |
const QString& QExtend::ILog::getDateFormat | ( | ) |
Get date string format.
const QString& QExtend::ILog::getLogFormat | ( | ) |
Get log string format.
const QString& QExtend::ILog::getTypeName | ( | LoggerType | type | ) |
Get log type name for a given type.
type | Type of the Log |
void QExtend::ILog::initLogAttributes | ( | ) | [protected] |
void QExtend::ILog::setDateFormat | ( | QString | dateFormat | ) |
Define date string format.
Date string format is the same as QDateTime::toString().
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)".
logFormat | Log string format |
void QExtend::ILog::setTypeName | ( | LoggerType | type, | |
QString | name | |||
) |
Define log type name.
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.
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.
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.
© 2000-2024 - www.developpez.com