|
QGroundControl
Ground Control Station for MAVLink Drones
|
#include <QGCLogging.h>
Inheritance diagram for QGCLogging:
Collaboration diagram for QGCLogging:Signals | |
| void | emitLog (const QString &message) |
| Emitted when a log message is enqueued. | |
| void | writeStarted () |
| Emitted when file write starts. | |
| void | writeFinished (bool success) |
| Emitted when file write finishes (success flag) | |
Public Member Functions | |
| QGCLogging (QObject *parent=nullptr) | |
| ~QGCLogging () | |
| void | writeMessages (const QString &destFile) |
| Write current log messages to a file asynchronously. | |
| void | log (const QString &message) |
| Enqueue a log message (thread-safe) | |
Static Public Member Functions | |
| static QGCLogging * | instance () |
| Get the singleton instance. | |
| static void | installHandler () |
| Install Qt message handler to route logs through this class. | |
| static void | setCaptureEnabled (bool enabled) |
| static void | clearCapturedMessages () |
| Discard all previously captured messages. | |
| static QList< CapturedLogMessage > | capturedMessages (const QString &category={}) |
| static bool | hasCapturedMessage (const QString &category, QtMsgType type) |
| static bool | hasCapturedWarning (const QString &category) |
| Convenience: captured warning in category? | |
| static bool | hasCapturedCritical (const QString &category) |
| Convenience: captured critical in category? | |
| static bool | hasCapturedUncategorizedMessage () |
| Return true if any uncategorized message was captured (e.g. raw qDebug/qWarning). | |
| static void | captureIfEnabled (QtMsgType type, const QMessageLogContext &context, const QString &msg) |
Definition at line 20 of file QGCLogging.h.
|
explicit |
Definition at line 55 of file QGCLogging.cc.
References emitLog().
| QGCLogging::~QGCLogging | ( | ) |
Definition at line 74 of file QGCLogging.cc.
|
static |
Return captured messages, optionally filtered to a single category. Pass an empty string to retrieve all messages.
Definition at line 103 of file QGCLogging.cc.
References s_capturedMessages, and s_captureMutex.
|
static |
Record a message into the capture buffer (if capture is enabled). Intended for external handler wrappers (e.g. the unit-test capture handler).
Definition at line 154 of file QGCLogging.cc.
References s_capturedMessages, s_captureEnabled, and s_captureMutex.
Referenced by msgHandler().
|
static |
Discard all previously captured messages.
Definition at line 97 of file QGCLogging.cc.
References s_capturedMessages, and s_captureMutex.
|
signal |
Emitted when a log message is enqueued.
Referenced by log(), and QGCLogging().
|
static |
Convenience: captured critical in category?
Definition at line 137 of file QGCLogging.cc.
References hasCapturedMessage().
|
static |
Return true if at least one message of the given type was captured for category.
Definition at line 120 of file QGCLogging.cc.
References s_capturedMessages, and s_captureMutex.
Referenced by hasCapturedCritical(), and hasCapturedWarning().
|
static |
Return true if any uncategorized message was captured (e.g. raw qDebug/qWarning).
Definition at line 142 of file QGCLogging.cc.
References s_capturedMessages, and s_captureMutex.
|
static |
Convenience: captured warning in category?
Definition at line 132 of file QGCLogging.cc.
References hasCapturedMessage().
|
static |
Install Qt message handler to route logs through this class.
Definition at line 79 of file QGCLogging.cc.
References msgHandler().
Referenced by main().
|
static |
Get the singleton instance.
Definition at line 50 of file QGCLogging.cc.
Referenced by msgHandler().
| void QGCLogging::log | ( | const QString & | message | ) |
Enqueue a log message (thread-safe)
Definition at line 166 of file QGCLogging.cc.
References emitLog().
Referenced by msgHandler().
|
static |
Enable or disable log capture (for unit testing). When enabled, every message passing through the Qt message handler is recorded with its category, type and raw text.
Definition at line 92 of file QGCLogging.cc.
References s_captureEnabled.
|
signal |
Emitted when file write finishes (success flag)
Referenced by writeMessages().
| void QGCLogging::writeMessages | ( | const QString & | destFile | ) |
Write current log messages to a file asynchronously.
Definition at line 277 of file QGCLogging.cc.
References writeFinished(), and writeStarted().
|
signal |
Emitted when file write starts.
Referenced by writeMessages().