TLogger Class

日志文件类; More...

Header: #include <TLogger>
Inherits: QObject

Public Functions

  • 31 public functions inherited from QObject

Public Slots

QString currentLogFileName() const
int debugLevel() const
QString fileExt() const
QString fileNameFormat() const
QVariantList historyLogs() const
QString logDir() const
int maxFileSize() const
int maxHistoryCount() const
QString nextLogFileName() const
bool setCurrentLogFile(const QString iFilepathStr)
void setDebugLevel(int iLevelInt)
void setFileExt(const QString &iExtStr)
void setFileNameFormat(const QString &iFormatStr)
void setLogDir(const QString &iDirStr)
void setMaxFileSize(int iSizeInta)
void setMaxHistoryCount(int iCountInt)
bool writeLog(const QString &iTextStr, const QString &iTypeStr = QString( "info" ), const QString &iDatetimeStr = QString( "" ), const QString &iSrcPosStr = QString( "" ), int iDebugLevelInt = 0)
  • 1 public slot inherited from QObject

Signals

void logWrited(QString iTextStr, QString iTypeStr, QString iDateTimeStr, QString iSrcPosStr, QString iDebugLevelStr)

Static Public Members

TLogger *instance()
  • 10 static public members inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public variable inherited from QObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

日志文件类;

Member Function Documentation

TLogger::~TLogger()

Destroys the instance of TLogger.

[slot] QString TLogger::currentLogFileName() const

获取当前日志文件名;

[slot] int TLogger::debugLevel() const

返回调试等级;

See also setDebugLevel().

[slot] QString TLogger::fileExt() const

设置日志文件的后缀,默认为.log;

See also setFileExt().

[slot] QString TLogger::fileNameFormat() const

获取日志文件名称格式,默认为yyMMdd;

See also setFileNameFormat().

[slot] QVariantList TLogger::historyLogs() const

获取日志历史记录;

[static] TLogger *TLogger::instance()

返回TLogger的单例对象;

[slot] QString TLogger::logDir() const

获取日志存放路径;

See also setLogDir().

[signal] void TLogger::logWrited(QString iTextStr, QString iTypeStr, QString iDateTimeStr, QString iSrcPosStr, QString iDebugLevelStr)

[slot] int TLogger::maxFileSize() const

获取单个日志文件的最大容量,默认为10*1000*1000bit;

See also setMaxFileSize().

[slot] int TLogger::maxHistoryCount() const

获取日志允许的最大历史记录行数;

See also setMaxHistoryCount().

[slot] QString TLogger::nextLogFileName() const

获取下一个日志文件名;

[slot] bool TLogger::setCurrentLogFile(const QString iFilepathStr)

设置当前日志文件;

[slot] void TLogger::setDebugLevel(int iLevelInt)

设置调试等级; 数字越大Log的信息越详细;

See also debugLevel().

[slot] void TLogger::setFileExt(const QString &iExtStr)

设置日志文件后缀;

See also fileExt().

[slot] void TLogger::setFileNameFormat(const QString &iFormatStr)

设置日志文件名称格式;

See also fileNameFormat().

[slot] void TLogger::setLogDir(const QString &iDirStr)

设置日志存放路径为iDirStr.

See also logDir().

[slot] void TLogger::setMaxFileSize(int iSizeInta)

设置单个日志文件的最大容量;

See also maxFileSize().

[slot] void TLogger::setMaxHistoryCount(int iCountInt)

设置日志允许的最大历史记录行数;

See also maxHistoryCount().

[slot] bool TLogger::writeLog(const QString &iTextStr, const QString &iTypeStr = QString( "info" ), const QString &iDatetimeStr = QString( "" ), const QString &iSrcPosStr = QString( "" ), int iDebugLevelInt = 0)

写日志,iTextStr为日志内容, iTypeStr为日志类型,error|warn|info|ok|step|debug|sql|jsprint, iDateTime为日志时间(默认为系统当前时间), iSrcPosStr为源码位置描述; iDebugLevel为调试等级;