25 #ifndef ZBLLOGMANAGER_H 26 #define ZBLLOGMANAGER_H 30 #include <QStringList> 36 #define zLogMan (Zbl::ZblLogManager::zInstance()) 322 QString
getQtLogRule(
const QString& category,
const QString& level,
bool enabled);
445 const QString& nameTemplate,
446 bool remove =
false);
508 const QMessageLogContext& logCtx,
509 const QString& text);
663 #endif // ZBLLOGMANAGER_H void onSettingsBundleAvailable(QString bundleId)
Responds to newly loaded settings bundles.
The Zuble Log Manager is a singleton object that controls logging in Zuble applications.
static const QString m_profileMetadata
Log profile metadata defines logger settings that are stored in a log profile.
ZblLogWorker * m_logWorker
A background thread worker object to handle logging rules and log record output.
void populateRegisteredRules()
Appends all log categories that have so far been registered with a call to ZblLogManager::registerLog...
void updateApplicationSettings()
void setQtLogRulesFromModel()
Sets Qt's internal logging rules from data contained in log manager's logging rules model...
#define ZBL_DECLARE_LOGGED_OBJECT
Q_INVOKABLE QObject * getLogBuffer()
Obtain the log buffer data model.
void onLogWorkerOutputParametersUpdated(QVariant logParams)
Synchronizes log manager and log worker output parameters.
static LogFileFormat fileFormatFromString(const QString &logFileFormat)
static ZblLogManager & zInit(QObject *parent)
Construct, initialize and obtain a reference to Zuble's log manager object.
bool populateMetaRules()
Appends all log categories defined in the Zuble application's zblconfig.xml configuration file to the...
bool loadCurrentLogProfile()
Replaces the current log settings with those from the specified file.
ZRoleNames m_bufferRoles
A hash of log buffer column numbers to column field names.
This class provides a thread-safe log message back end for the Zuble log manager. ...
bool registerLogCategory(const QString logCategory)
Adds the specified log category to the registered log category list.
bool appendRuleModelCategory(const QString &logCategory)
Adds a new category to the rule model. If the category already exists in the rule model the request t...
enum Zbl::logFileFormat LogFileFormat
Specifies the output format for Zuble log files.
ruleFields
Roles for the logging rules data model.
void setApplicationObject(ZApplication *appObject)
Connects the log manager to appropriate Zuble core plugin signals and attempts to load the current lo...
static int m_maxBufferSize
The number of logging records the circular log buffer will attempt to hold.
bool m_loadingProfile
true when log manager is currently loading a log profile, false otherwise
bool loadFilterRules(const QString &logProfileBundleID)
Loades the log filter rules from the specified log profile into the log rule model.
void onRuleModelModified(int dataRole, int rowNumber)
Responds to changes in the rule model by updating Qt's internal rule model and the current log settin...
ZDataRow m_modelBooleanRow
A data row to use as a template for constructing role rows.
ZDataRow m_modelCategoryRow
A data row to use as a template for constructing role rows.
void updateLogProfileSettings()
Loads a new copy of the log profile settings from the settings file.
ZblLogParams m_logParam
Current Zuble logging parameters.
logFileFormat
Specifies the output format for Zuble log files.
The core Zuble QML Extension plugin class.
ZBL_DECLARE_LOGGED_OBJECT QString getQtLogRule(const QString &category, const QString &level, bool enabled)
Returns a Qt logging rule string for the given log category and level.
static ZblLogManager & zInstance()
Obtain a reference to Zuble's log manager object.
ZTableModel * createLogBufferModel(QObject *parent=NULL)
Creates a new log record data model by appending the appropriate data rules. The caller assumes owner...
QMap< int, QList< QVariant > > ZRoleRow
Represents a single row (or column for column headers) of data cell values for multiple roles...
static const QString m_defaultOutputFilePath
TBD: currently unused!
ZTableModel * m_logBuffer
Zuble's log buffer provides a viewable record of recent log activity.
This two dimensional table model is used to store and manipulate data.
ZTableModel * m_logRules
A data model containing the current logging rules in effect for each known log category.
void saveFilterRules()
Saves the current state of the logging rules data model to the current log profile.
QString getQtLogRulesForRow(int rowNumber)
Returns a Qt logging rule string for all logging levels for the specified row (log category) in the l...
virtual void timerEvent(QTimerEvent *event)
Timer is used to flush excess log records from the log record buffer.
Q_INVOKABLE int getLogBufferRoleCount()
Obtain the number of roles in the log buffer data model.
QtMessageHandler m_originalMsgHandler
Pointer to the original (non-Zuble) message handler, or nullptr if Zuble logging has not yet been ena...
Wraps the QSettings class and implements a JSON-based backend for storing the settings data...
This class contains the Zuble logging parameters that control log output.
bool m_syncProfiles
true if all application instances update the same log profile, false if each instance updates a separ...
static const QString m_zubleSettingsBundleId
The bundle ID for the zuble application settings = "default".
bool startLogThread()
Starts log manager's background thread.
void onLogProfileModified(const QString &path)
Responds to changes to the current log settings by replacing the log profile with the current log set...
static QString createTemporaryLogProfile(const QString &nameTemplate, bool remove=false)
Creates an empty file with a unique file name in the log profile directory.
QHash< int, QByteArray > ZRoleNames
Maps role numbers to role names as a hash table object.
void onZubleSettingsModified(const QString &path)
Responds to changes in the Zuble application settingsby updating log manager's internal state...
Zuble's Singleton Application Object.
static ZblLogManager * m_zLog
The one and only ZblLogManager object in this process.
Zuble objects embed this class to save local logging state.
void stopLogThread()
Stops log manager's background thread.
static const int m_logBufRoleCount
The number of roles contained in a log file record.
static QString getLogSettingsMetadata()
Returns an xml data structure that defines the zuble application's log settings.
static void zMessageHandler(QtMsgType msgType, const QMessageLogContext &logCtx, const QString &text)
Zuble's Qt message handler.
ZSettings * m_logSettings
A ZSettings object to track the application settings for changes that control Zuble logging...
QString m_LogSource
String inserted into the "source" field of log records.
bool createRuleModel()
Creates the log manager's log rules data model and initializes associated variables used to optimize ...
ZSettings * m_profileSettings
A ZSettings object to track the current log profile for changes to the profile settings.
ZblLogManager(QObject *parent=0)
ZRoleRow m_modelRoleRow
A role row to use as a template for adding logging rules to the rule model.
bool isCommandLineLogging()
Returns true if -zl option is passed in on command line.
logFields
Roles for the log record data model.
static const QString m_logFilterRulesKey
The log filter rules key = "log-filter-rules".
QThread m_logThread
A background thread to handle logging rules and log record output.
QList< QVariant > ZDataRow
Represents a single row (or column for column headers) of data cell values for a single role...
static const QString m_currentLogSettingsBundleId
The bundle ID for the current logging profile = "current-log-profile".
int m_timerID
ID for the log manager's event timer.
Q_INVOKABLE QObject * getLogRules()
Obtain the logging rules data model.
void setLogOutputParameters()
Gathers the application and log profile settings that affect log output and synchronizes those parame...