Log.category for DBus server

This commit is contained in:
Klaus Basan
2020-01-15 02:38:47 +01:00
parent 9dee6acef9
commit 143ac8576a
5 changed files with 21 additions and 2 deletions

View File

@@ -109,6 +109,12 @@ namespace BlackMisc
return CDBusServer::isP2PConnection(connection) ? empty : CDBusServer::coreServiceName();
}
const CLogCategoryList &CDBusServer::getLogCategories()
{
static const CLogCategoryList cats({ CLogCategory::dbus() });
return cats;
}
bool CDBusServer::isP2PAddress(const QString &address)
{
return modeOfAddress(address) == SERVERMODE_P2P;

View File

@@ -11,6 +11,7 @@
#ifndef BLACKMISC_DBUSSERVER_H
#define BLACKMISC_DBUSSERVER_H
#include "blackmisc/logcategorylist.h"
#include "blackmisc/blackmiscexport.h"
#include <QDBusConnection>
@@ -46,6 +47,9 @@ namespace BlackMisc
//! Service name, empty if is P2P connection
static const QString &coreServiceName(const QDBusConnection &connection);
//! Log categories
static const CLogCategoryList &getLogCategories();
//! Server mode
enum ServerMode
{
@@ -61,7 +65,7 @@ namespace BlackMisc
CDBusServer(const QString &service, const QString &address, QObject *parent = nullptr);
//! Destructor
virtual ~CDBusServer();
virtual ~CDBusServer() override;
//! Add a QObject to be exposed via DBus
void addObject(const QString &name, QObject *object);

View File

@@ -67,6 +67,13 @@ namespace BlackMisc
return cat;
}
//! DBus related
static const CLogCategory &dbus()
{
static const CLogCategory cat { "swift.dbus" };
return cat;
}
//! Contexts
static const CLogCategory &context()
{
@@ -297,6 +304,7 @@ namespace BlackMisc
cmdLine(),
context(),
contextSlot(),
dbus(),
dataInconsistency(),
download(),
driver(),

View File

@@ -28,6 +28,7 @@ namespace BlackMisc
{ "cache", exactMatch(CLogCategory::cache()) },
{ "cmd.line handling", exactMatch(CLogCategory::cmdLine()) },
{ "data inconsistency", exactMatch(CLogCategory::dataInconsistency()) },
{ "DBus", exactMatch(CLogCategory::dbus()) },
{ "downloading data", exactMatch(CLogCategory::download()) },
{ "driver", exactMatch(CLogCategory::driver()) },
{ "flight plan", exactMatch(CLogCategory::flightPlan()) },