QtCanpool 3.3.0
载入中...
搜索中...
未找到
QxCore::QxLogger类 参考

Application logging built on top of Qt's message handler: the usual qDebug()/qInfo()/qWarning()/qCritical() calls are captured, formatted with a timestamp, level and category, and written to the console and/or a rotating log file. 更多...

#include <qxcore/qxlogger.h>

类

struct  Options
 

Public 类型

enum  Level {
  Debug = 0 , Info , Warning , Critical ,
  Fatal
}
 Level letters used in the output, in ascending severity. 更多...
 

静态 Public 成员函数

static bool init (const Options &options=Options())
 Installs the message handler.
 
static void shutdown ()
 Flushes and uninstalls the message handler.
 
static bool isEnabled ()
 
static QString fileName ()
 Path of the active log file, empty when file output is disabled.
 
static void flush ()
 Flushes buffered output to disk.
 
static void write (Level level, const QString &category, const QString &message)
 Formats and writes one message, bypassing the installed handler.
 
static void write (Level level, const QLoggingCategory &category, const QString &message)
 Convenience overload that reads the name from category.
 

详细描述

Application logging built on top of Qt's message handler: the usual qDebug()/qInfo()/qWarning()/qCritical() calls are captured, formatted with a timestamp, level and category, and written to the console and/or a rotating log file.

All members are static: the logger owns process-wide state, and init() must be called once before the first message is logged. shutdown() restores the previous message handler, which keeps the class usable in tests.

在文件 qxlogger.h 第 25 行定义.

成员枚举类型说明

◆ Level

Level letters used in the output, in ascending severity.

枚举值
Debug 
Info 
Warning 
Critical 
Fatal 

在文件 qxlogger.h 第 29 行定义.

成员函数说明

◆ fileName()

QString QxCore::QxLogger::fileName ( )
static

Path of the active log file, empty when file output is disabled.

在文件 qxlogger.cpp 第 172 行定义.

◆ flush()

void QxCore::QxLogger::flush ( )
static

Flushes buffered output to disk.

在文件 qxlogger.cpp 第 179 行定义.

◆ init()

bool QxCore::QxLogger::init ( const Options &  options = Options())
static

Installs the message handler.

Repeated calls replace the previous configuration; returns false when the log file cannot be opened, in which case console output is still active.

在文件 qxlogger.cpp 第 123 行定义.

◆ isEnabled()

bool QxCore::QxLogger::isEnabled ( )
static

在文件 qxlogger.cpp 第 165 行定义.

◆ shutdown()

void QxCore::QxLogger::shutdown ( )
static

Flushes and uninstalls the message handler.

在文件 qxlogger.cpp 第 147 行定义.

◆ write() [1/2]

void QxCore::QxLogger::write ( Level  level,
const QLoggingCategory &  category,
const QString &  message 
)
static

Convenience overload that reads the name from category.

在文件 qxlogger.cpp 第 188 行定义.

◆ write() [2/2]

void QxCore::QxLogger::write ( Level  level,
const QString &  category,
const QString &  message 
)
static

Formats and writes one message, bypassing the installed handler.

在文件 qxlogger.cpp 第 193 行定义.


该类的文档由以下文件生成: