mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 02:16:04 +08:00
Log.category for DBus server
This commit is contained in:
@@ -109,6 +109,12 @@ namespace BlackMisc
|
|||||||
return CDBusServer::isP2PConnection(connection) ? empty : CDBusServer::coreServiceName();
|
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)
|
bool CDBusServer::isP2PAddress(const QString &address)
|
||||||
{
|
{
|
||||||
return modeOfAddress(address) == SERVERMODE_P2P;
|
return modeOfAddress(address) == SERVERMODE_P2P;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#ifndef BLACKMISC_DBUSSERVER_H
|
#ifndef BLACKMISC_DBUSSERVER_H
|
||||||
#define BLACKMISC_DBUSSERVER_H
|
#define BLACKMISC_DBUSSERVER_H
|
||||||
|
|
||||||
|
#include "blackmisc/logcategorylist.h"
|
||||||
#include "blackmisc/blackmiscexport.h"
|
#include "blackmisc/blackmiscexport.h"
|
||||||
|
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
@@ -46,6 +47,9 @@ namespace BlackMisc
|
|||||||
//! Service name, empty if is P2P connection
|
//! Service name, empty if is P2P connection
|
||||||
static const QString &coreServiceName(const QDBusConnection &connection);
|
static const QString &coreServiceName(const QDBusConnection &connection);
|
||||||
|
|
||||||
|
//! Log categories
|
||||||
|
static const CLogCategoryList &getLogCategories();
|
||||||
|
|
||||||
//! Server mode
|
//! Server mode
|
||||||
enum ServerMode
|
enum ServerMode
|
||||||
{
|
{
|
||||||
@@ -61,7 +65,7 @@ namespace BlackMisc
|
|||||||
CDBusServer(const QString &service, const QString &address, QObject *parent = nullptr);
|
CDBusServer(const QString &service, const QString &address, QObject *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CDBusServer();
|
virtual ~CDBusServer() override;
|
||||||
|
|
||||||
//! Add a QObject to be exposed via DBus
|
//! Add a QObject to be exposed via DBus
|
||||||
void addObject(const QString &name, QObject *object);
|
void addObject(const QString &name, QObject *object);
|
||||||
|
|||||||
@@ -67,6 +67,13 @@ namespace BlackMisc
|
|||||||
return cat;
|
return cat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! DBus related
|
||||||
|
static const CLogCategory &dbus()
|
||||||
|
{
|
||||||
|
static const CLogCategory cat { "swift.dbus" };
|
||||||
|
return cat;
|
||||||
|
}
|
||||||
|
|
||||||
//! Contexts
|
//! Contexts
|
||||||
static const CLogCategory &context()
|
static const CLogCategory &context()
|
||||||
{
|
{
|
||||||
@@ -297,6 +304,7 @@ namespace BlackMisc
|
|||||||
cmdLine(),
|
cmdLine(),
|
||||||
context(),
|
context(),
|
||||||
contextSlot(),
|
contextSlot(),
|
||||||
|
dbus(),
|
||||||
dataInconsistency(),
|
dataInconsistency(),
|
||||||
download(),
|
download(),
|
||||||
driver(),
|
driver(),
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace BlackMisc
|
|||||||
{ "cache", exactMatch(CLogCategory::cache()) },
|
{ "cache", exactMatch(CLogCategory::cache()) },
|
||||||
{ "cmd.line handling", exactMatch(CLogCategory::cmdLine()) },
|
{ "cmd.line handling", exactMatch(CLogCategory::cmdLine()) },
|
||||||
{ "data inconsistency", exactMatch(CLogCategory::dataInconsistency()) },
|
{ "data inconsistency", exactMatch(CLogCategory::dataInconsistency()) },
|
||||||
|
{ "DBus", exactMatch(CLogCategory::dbus()) },
|
||||||
{ "downloading data", exactMatch(CLogCategory::download()) },
|
{ "downloading data", exactMatch(CLogCategory::download()) },
|
||||||
{ "driver", exactMatch(CLogCategory::driver()) },
|
{ "driver", exactMatch(CLogCategory::driver()) },
|
||||||
{ "flight plan", exactMatch(CLogCategory::flightPlan()) },
|
{ "flight plan", exactMatch(CLogCategory::flightPlan()) },
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#include <utility>
|
|
||||||
|
|
||||||
/* Copyright (C) 2018
|
/* Copyright (C) 2018
|
||||||
* swift project Community / Contributors
|
* swift project Community / Contributors
|
||||||
@@ -12,6 +11,7 @@
|
|||||||
#include "dbusobject.h"
|
#include "dbusobject.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|||||||
Reference in New Issue
Block a user