mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
refs #316 Removed old logging mechanism in contexts.
This commit is contained in:
@@ -36,17 +36,6 @@ namespace BlackCore
|
||||
public:
|
||||
//! Log message category
|
||||
static QString getMessageCategory() { return "swift.runtime"; }
|
||||
//! Tags to identify the context when logging a slot
|
||||
enum LogContext
|
||||
{
|
||||
LogDefault = 0,
|
||||
LogForApplication,
|
||||
LogForAudio,
|
||||
LogForNetwork,
|
||||
LogForOwnAircraft,
|
||||
LogForSettings,
|
||||
LogForSimulator
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
CRuntime(const CRuntimeConfig &config, QObject *parent = nullptr);
|
||||
@@ -60,147 +49,6 @@ namespace BlackCore
|
||||
//! DBus connection (if applicable)
|
||||
const QDBusConnection &getDBusConnection() const { return this->m_dbusConnection; }
|
||||
|
||||
//! Enable / disable all logging
|
||||
//! \threadsafe
|
||||
void signalLog(bool enabled);
|
||||
|
||||
//! Signal logging for application context
|
||||
//! \threadsafe
|
||||
bool signalLogForApplication(bool enabled);
|
||||
|
||||
//! Signal logging for audio context
|
||||
//! \threadsafe
|
||||
bool signalLogForAudio(bool enabled);
|
||||
|
||||
//! Signal logging for network context
|
||||
//! \threadsafe
|
||||
bool signalLogForNetwork(bool enabled);
|
||||
|
||||
//! Signal logging for own aircraft context
|
||||
//! \threadsafe
|
||||
bool signalLogForOwnAircraft(bool enabled);
|
||||
|
||||
//! Signal logging for settings context
|
||||
//! \threadsafe
|
||||
bool signalLogForSettings(bool enabled);
|
||||
|
||||
//! Signal logging for simulator context
|
||||
//! \threadsafe
|
||||
bool signalLogForSimulator(bool enabled);
|
||||
|
||||
//! Enable / disable all logging
|
||||
//! \threadsafe
|
||||
void slotLog(bool enabled);
|
||||
|
||||
//! Slot logging for application context
|
||||
//! \threadsafe
|
||||
void slotLogForApplication(bool enabled)
|
||||
{
|
||||
QWriteLocker wl(&m_lock);
|
||||
this->m_slotLogApplication = enabled;
|
||||
}
|
||||
|
||||
//! Slot logging for audio context
|
||||
//! \threadsafe
|
||||
void slotLogForAudio(bool enabled)
|
||||
{
|
||||
QWriteLocker wl(&m_lock);
|
||||
this->m_slotLogAudio = enabled;
|
||||
}
|
||||
|
||||
//! Slot logging for network context
|
||||
//! \threadsafe
|
||||
void slotLogForNetwork(bool enabled)
|
||||
{
|
||||
QWriteLocker wl(&m_lock);
|
||||
this->m_slotLogNetwork = enabled;
|
||||
}
|
||||
|
||||
//! Slot logging for own aircraft context
|
||||
//! \threadsafe
|
||||
void slotLogForOwnAircraft(bool enabled)
|
||||
{
|
||||
QWriteLocker wl(&m_lock);
|
||||
this->m_slotLogOwnAircraft = enabled;
|
||||
}
|
||||
|
||||
//! Slot logging for settings context
|
||||
//! \threadsafe
|
||||
void slotLogForSettings(bool enabled)
|
||||
{
|
||||
QWriteLocker wl(&m_lock);
|
||||
this->m_slotLogSettings = enabled;
|
||||
}
|
||||
|
||||
//! Slot logging for simulator context
|
||||
//! \threadsafe
|
||||
void slotLogForSimulator(bool enabled)
|
||||
{
|
||||
QWriteLocker wl(&m_lock);
|
||||
this->m_slotLogSimulator = enabled;
|
||||
}
|
||||
|
||||
//! Slot logging for application context
|
||||
//! \threadsafe
|
||||
bool isSlotLogForApplicationEnabled() const
|
||||
{
|
||||
QReadLocker rl(&m_lock);
|
||||
return this->m_slotLogApplication;
|
||||
}
|
||||
|
||||
//! Slot logging for audio context
|
||||
//! \threadsafe
|
||||
bool isSlotLogForAudioEnabled() const
|
||||
{
|
||||
QReadLocker rl(&m_lock);
|
||||
return this->m_slotLogAudio;
|
||||
}
|
||||
|
||||
//! Slot logging for network context
|
||||
//! \threadsafe
|
||||
bool isSlotLogForNetworkEnabled() const
|
||||
{
|
||||
QReadLocker rl(&m_lock);
|
||||
return this->m_slotLogNetwork;
|
||||
}
|
||||
|
||||
//! Slot log for own aircraft
|
||||
//! \threadsafe
|
||||
bool isSlotLogForOwnAircraftEnabled() const
|
||||
{
|
||||
QReadLocker rl(&m_lock);
|
||||
return this->m_slotLogOwnAircraft;
|
||||
}
|
||||
|
||||
//! Slot logging for settings context
|
||||
//! \threadsafe
|
||||
bool isSlotLogForSettingsEnabled() const
|
||||
{
|
||||
QReadLocker rl(&m_lock);
|
||||
return this->m_slotLogSettings;
|
||||
}
|
||||
|
||||
//! Slot logging for simulator context
|
||||
//! \threadsafe
|
||||
bool isSlotLogForSimulatorEnabled() const
|
||||
{
|
||||
QReadLocker rl(&m_lock);
|
||||
return this->m_slotLogSimulator;
|
||||
}
|
||||
|
||||
//! Slot logging for specified context
|
||||
//! \threadsafe
|
||||
bool isSlotLogEnabledFor(LogContext context) const;
|
||||
|
||||
//! Slot logging from a specific context
|
||||
void logSlot(LogContext ctx, const char *func, const QString ¶m = "") const;
|
||||
|
||||
//! Slot logging from a specific context
|
||||
void logSlot(LogContext ctx, const char *func, const QStringList ¶ms) const;
|
||||
|
||||
//! Slot logging for bool value from a specific context
|
||||
void logSlot(LogContext ctx, const char *func, bool boolValue) const;
|
||||
|
||||
//! Clean up (will be connected to signal QCoreApplication::aboutToQuit)
|
||||
void gracefulShutdown();
|
||||
|
||||
@@ -305,18 +153,6 @@ namespace BlackCore
|
||||
bool m_init; /*!< flag */
|
||||
CDBusServer *m_dbusServer;
|
||||
bool m_initDBusConnection;
|
||||
bool m_signalLogApplication;
|
||||
bool m_signalLogAudio;
|
||||
bool m_signalLogNetwork;
|
||||
bool m_signalLogOwnAircraft;
|
||||
bool m_signalLogSettings;
|
||||
bool m_signalLogSimulator;
|
||||
bool m_slotLogApplication;
|
||||
bool m_slotLogAudio;
|
||||
bool m_slotLogNetwork;
|
||||
bool m_slotLogOwnAircraft;
|
||||
bool m_slotLogSettings;
|
||||
bool m_slotLogSimulator;
|
||||
QDBusConnection m_dbusConnection;
|
||||
IContextApplication *m_contextApplication;
|
||||
IContextAudio *m_contextAudio;
|
||||
@@ -324,7 +160,6 @@ namespace BlackCore
|
||||
IContextOwnAircraft *m_contextOwnAircraft;
|
||||
IContextSettings *m_contextSettings;
|
||||
IContextSimulator *m_contextSimulator;
|
||||
QMultiMap<QString, QMetaObject::Connection> m_logSignalConnections;
|
||||
mutable QReadWriteLock m_lock;
|
||||
|
||||
//! initialization of DBus connection (where applicable)
|
||||
@@ -335,21 +170,6 @@ namespace BlackCore
|
||||
|
||||
//! post init tasks, mainly connecting context signal slots
|
||||
void initPostSetup();
|
||||
|
||||
//! log
|
||||
void logSignal(QObject *sender, const QStringList &values);
|
||||
|
||||
//! disconnect log signals (connected via connection to log them)
|
||||
void disconnectLogSignals(const QString &name);
|
||||
|
||||
//! Slot logging
|
||||
void logSlot(const char *func, const QString ¶m = "") const;
|
||||
|
||||
//! Slot logging
|
||||
void logSlot(const char *func, const QStringList ¶ms) const;
|
||||
|
||||
//! Slot logging for bool value
|
||||
void logSlot(const char *func, bool boolValue) const;
|
||||
};
|
||||
}
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user