Skip to content

Commit

Permalink
feat: add deepin-log config
Browse files Browse the repository at this point in the history
添加日志搜集相关配置

Log:
  • Loading branch information
myml committed Dec 27, 2023
1 parent b671264 commit f8ed8ab
Show file tree
Hide file tree
Showing 60 changed files with 344 additions and 265 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*.a

build*/
.linglong-target
*.pro.user*
*.DS_Store
*.core
Expand All @@ -30,4 +31,5 @@ build/
Makefile
!debian/[source,changelog,compat,control,copyright,rules]
CMakeLists.txt.user
*.user.*
*.user.*
binaries
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,5 @@ qt5_create_translation(DTNG_QM_FILES

file(GLOB APP_QM_FILES "translations/*.qm")
install(FILES ${APP_QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/dde-calendar/translations)
# 安装日志搜集工具的配置
install(FILES "org.deepin.calendar.json" DESTINATION ${CMAKE_INSTALL_DATADIR}/deepin-log-viewer/deepin-log.conf.d/)
9 changes: 5 additions & 4 deletions calendar-client/src/customWidget/jobtypelistview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "jobtypelistview.h"
#include "cscheduleoperation.h"
#include "commondef.h"
#include "scheduletypeeditdlg.h"
#include "schedulectrldlg.h"
#include "accountmanager.h"
Expand Down Expand Up @@ -215,7 +216,7 @@ void JobTypeListView::slotImportScheduleType()
}
auto fileinfo = QFileInfo(filename);
if (!fileinfo.exists()) {
qWarning() << "ics file not exists";
qCWarning(ClientLogger) << "ics file not exists";
return;
}
AccountItem::Ptr account = gAccountManager->getAccountItemByAccountId(m_account_id);
Expand Down Expand Up @@ -264,7 +265,7 @@ void JobTypeListView::slotImportScheduleType()
// 二来在导入大文件时堵塞dbus调用,延迟可以避免客户端在日程类型更新信号执行的槽函数被堵塞。
QTimer::singleShot(1000, &event, &QEventLoop::quit);
});
qDebug() << "import" << typeID << "from" << filename;
qCDebug(ClientLogger) << "import" << typeID << "from" << filename;
// 等待日程创建完毕
event.exec();
// 导入ics文件
Expand Down Expand Up @@ -296,9 +297,9 @@ void JobTypeListView::slotExportScheduleType()
QEventLoop event;
m_waitDialog->show();
auto typeID = info.typeID();
qDebug() << "export" << typeID << "to" << filename;
qCDebug(ClientLogger) << "export" << typeID << "to" << filename;
account->exportSchedule(filename, typeID, [&filename, &event](CallMessge msg) {
qDebug() << msg.code << msg.msg;
qCDebug(ClientLogger) << msg.code << msg.msg;
if (msg.code == 0) {
DDesktopServices::showFileItem(filename);
}
Expand Down
7 changes: 4 additions & 3 deletions calendar-client/src/dbus/dbusaccountmanagerrequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "dbusaccountmanagerrequest.h"
#include "commondef.h"
#include <QDBusInterface>
#include <QDebug>

Expand Down Expand Up @@ -132,7 +133,7 @@ void DbusAccountManagerRequest::slotCallFinished(CDBusPendingCallWatcher *call)
//错误处理
if (call->isError()) {
//打印错误信息
qWarning() << call->reply().member() << call->error().message();
qCWarning(ClientLogger) << call->reply().member() << call->error().message();
ret = 1;
} else if (call->getmember() == "getAccountList") {
//"getAccountList"方法回调事件
Expand All @@ -144,7 +145,7 @@ void DbusAccountManagerRequest::slotCallFinished(CDBusPendingCallWatcher *call)
if (DAccount::fromJsonListString(accountList, str)) {
emit signalGetAccountListFinish(accountList);
} else {
qWarning() <<"AccountList Parsing failed!";
qCWarning(ClientLogger) <<"AccountList Parsing failed!";
ret = 2;
}
} else if (call->getmember() == "getCalendarGeneralSettings") {
Expand All @@ -155,7 +156,7 @@ void DbusAccountManagerRequest::slotCallFinished(CDBusPendingCallWatcher *call)
if (DCalendarGeneralSettings::fromJsonString(ptr, str)) {
emit signalGetGeneralSettingsFinish(ptr);
} else {
qWarning() <<"AccountList Parsing failed!";
qCWarning(ClientLogger) <<"AccountList Parsing failed!";
ret = 2;
}
} else if (call->getmember() == "setCalendarGeneralSettings") {
Expand Down
11 changes: 6 additions & 5 deletions calendar-client/src/dbus/dbusaccountrequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "dbusaccountrequest.h"
#include "commondef.h"
#include <QDBusInterface>

#include <QDBusReply>
Expand Down Expand Up @@ -174,7 +175,7 @@ DSchedule::Ptr DbusAccountRequest::getScheduleByScheduleID(const QString &schedu
pCall.waitForFinished();
QDBusMessage reply = pCall.reply();
if (reply.type() != QDBusMessage::ReplyMessage) {
qWarning() << "getScheduleTypeByID error ," << reply;
qCWarning(ClientLogger) << "getScheduleTypeByID error ," << reply;
return nullptr;
}
QDBusReply<QString> scheduleReply = reply;
Expand Down Expand Up @@ -228,7 +229,7 @@ bool DbusAccountRequest::querySchedulesByExternal(const DScheduleQueryPar::Ptr &
{
QDBusPendingReply<QString> reply = call("querySchedulesWithParameter", QVariant(params));
if (reply.isError()) {
qWarning() << reply.error().message();
qCWarning(ClientLogger) << reply.error().message();
return false;
}
json = reply.argumentAt<0>();
Expand All @@ -254,7 +255,7 @@ void DbusAccountRequest::slotCallFinished(CDBusPendingCallWatcher *call)
QVariant msg;

if (call->isError()) {
qWarning() << call->reply().member() << call->error().message();
qCWarning(ClientLogger) << call->reply().member() << call->error().message();
ret = 1;
} else {
if (call->getmember() == "getAccountInfo") {
Expand All @@ -265,7 +266,7 @@ void DbusAccountRequest::slotCallFinished(CDBusPendingCallWatcher *call)
if (DAccount::fromJsonString(ptr, str)) {
emit signalGetAccountInfoFinish(ptr);
} else {
qWarning() << "AccountInfo Parsing failed!";
qCWarning(ClientLogger) << "AccountInfo Parsing failed!";
ret = 2;
}
} else if (call->getmember() == "getScheduleTypeList") {
Expand All @@ -275,7 +276,7 @@ void DbusAccountRequest::slotCallFinished(CDBusPendingCallWatcher *call)
if (DScheduleType::fromJsonListString(stList, str)) {
emit signalGetScheduleTypeListFinish(stList);
} else {
qWarning() << "ScheduleTypeList Parsing failed!";
qCWarning(ClientLogger) << "ScheduleTypeList Parsing failed!";
ret = 2;
}
} else if (call->getmember() == "querySchedulesWithParameter") {
Expand Down
9 changes: 5 additions & 4 deletions calendar-client/src/dbus/dbushuanglirequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "dbushuanglirequest.h"
#include "commondef.h"
#include <QDebug>

DbusHuangLiRequest::DbusHuangLiRequest(QObject *parent)
Expand All @@ -22,7 +23,7 @@ bool DbusHuangLiRequest::getFestivalMonth(quint32 year, quint32 month, FestivalI
QDBusPendingReply<QString> reply = call("getFestivalMonth", QVariant(year), QVariant(month));

if (reply.isError()) {
qWarning() << reply.error().message();
qCWarning(ClientLogger) << reply.error().message();
return false;
}

Expand Down Expand Up @@ -84,7 +85,7 @@ bool DbusHuangLiRequest::getHuangLiDay(quint32 year, quint32 month, quint32 day,
QDBusPendingReply<QString> reply = call("getHuangLiDay", QVariant(year), QVariant(month), QVariant(day));

if (reply.isError()) {
qWarning() << reply.error().message();
qCWarning(ClientLogger) << reply.error().message();
return false;
}

Expand All @@ -105,7 +106,7 @@ bool DbusHuangLiRequest::getHuangLiMonth(quint32 year, quint32 month, bool fill,
{
QDBusPendingReply<QString> reply = call("getHuangLiMonth", QVariant(year), QVariant(month), QVariant(fill));
if (reply.isError()) {
qWarning() << reply.error().message();
qCWarning(ClientLogger) << reply.error().message();
return false;
}
QString json = reply.argumentAt<0>();
Expand Down Expand Up @@ -142,7 +143,7 @@ void DbusHuangLiRequest::getLunarMonthCalendar(quint32 year, quint32 month, bool
void DbusHuangLiRequest::slotCallFinished(CDBusPendingCallWatcher* call)
{
if (call->isError()) {
qWarning() << call->reply().member() << call->error().message();
qCWarning(ClientLogger) << call->reply().member() << call->error().message();
return;
}
call->deleteLater();
Expand Down
5 changes: 3 additions & 2 deletions calendar-client/src/dbus/dbusrequestbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "dbusrequestbase.h"
#include "commondef.h"
#include <QDebug>

DbusRequestBase::DbusRequestBase(const QString &path, const QString &interface, const QDBusConnection &connection, QObject *parent)
: QDBusAbstractInterface(DBUS_SERVER_NAME, path, interface.toStdString().c_str(), connection, parent)
{
//关联后端dbus触发信号
if (!QDBusConnection::sessionBus().connect(this->service(), this->path(), this->interface(), "", this, SLOT(slotDbusCall(QDBusMessage)))) {
qWarning() << "the connection was fail!" << "path: " << this->path() << "interface: " << this->interface();
qCWarning(ClientLogger) << "the connection was fail!" << "path: " << this->path() << "interface: " << this->interface();
};
//关联后端dbus触发信号
if (!QDBusConnection::sessionBus().connect(this->service(), this->path(), "org.freedesktop.DBus.Properties", "", this, SLOT(slotDbusCall(QDBusMessage)))) {
qWarning() << "the connection was fail!" << "path: " << this->path() << "interface: " << this->interface();
qCWarning(ClientLogger) << "the connection was fail!" << "path: " << this->path() << "interface: " << this->interface();
};
}

Expand Down
5 changes: 3 additions & 2 deletions calendar-client/src/dbus/dbustimedate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "dbustimedate.h"
#include "commondef.h"

#include <QDBusPendingReply>
#include <QDBusReply>
Expand All @@ -22,8 +23,8 @@ DBusTimedate::DBusTimedate(QObject *parent)
"org.freedesktop.DBus.Properties",
QLatin1String("PropertiesChanged"), this,
SLOT(propertiesChanged(QDBusMessage)))) {
qWarning() << "the PropertiesChanged was fail!";
qWarning() << this->lastError();
qCWarning(ClientLogger) << "the PropertiesChanged was fail!";
qCWarning(ClientLogger) << this->lastError();
}

m_hasDateTimeFormat = getHasDateTimeFormat();
Expand Down
5 changes: 3 additions & 2 deletions calendar-client/src/dbus/doanetworkdbus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "doanetworkdbus.h"
#include "commondef.h"

#include <QDBusPendingReply>
#include <QDBusReply>
Expand All @@ -13,12 +14,12 @@ DOANetWorkDBus::DOANetWorkDBus(QObject *parent)
: QDBusAbstractInterface(NETWORK_DBUS_NAME, NETWORK_DBUS_PATH, NETWORK_DBUS_INTEERFACENAME, QDBusConnection::sessionBus(), parent)
{
if (!this->isValid()) {
qWarning() << "Error connecting remote object, service:" << this->service() << ",path:" << this->path() << ",interface" << this->interface();
qCWarning(ClientLogger) << "Error connecting remote object, service:" << this->service() << ",path:" << this->path() << ",interface" << this->interface();
}

//关联后端dbus触发信号
if (!QDBusConnection::sessionBus().connect(this->service(), this->path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", "sa{sv}as", this, SLOT(propertiesChanged(QDBusMessage)))) {
qWarning() << "the connection was fail!";
qCWarning(ClientLogger) << "the connection was fail!";
}
}

Expand Down
3 changes: 2 additions & 1 deletion calendar-client/src/dialog/scheduledlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "configsettings.h"
#include "accountmanager.h"
#include "units.h"
#include "commondef.h"

#include <DHiDPIHelper>
#include <DFontSizeManager>
Expand Down Expand Up @@ -590,7 +591,7 @@ void CScheduleDlg::signalLogout(DAccount::Type type)
if (DAccount::Account_UnionID == type && gUosAccountItem == m_accountItem) {
if (m_type) {
//TODO:弹窗提示?
qInfo() << m_accountComBox->currentText() << "帐户已退出";
qCInfo(ClientLogger) << m_accountComBox->currentText() << "帐户已退出";
getButtons()[1]->setEnabled(false);
m_accountItem.reset(nullptr);
} else {
Expand Down
11 changes: 8 additions & 3 deletions calendar-client/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "accessible/accessible.h"
#include "tabletconfig.h"
#include "schedulemanager.h"
#include "commondef.h"
#include <LogManager.h>

#include <DApplication>
#include <DLog>
Expand Down Expand Up @@ -51,7 +53,7 @@ int main(int argc, char *argv[])
#ifdef QT_DEBUG
// 在开发调试时使用项目内的翻译文件
auto tf = "../translations/dde-calendar_zh_CN";
qDebug() << "load translate" << tf;
qCDebug(ClientLogger) << "load translate" << tf;
QTranslator translator;
translator.load(tf);
app->installTranslator(&translator);
Expand All @@ -78,6 +80,7 @@ int main(int argc, char *argv[])
viewtype = 2;
DLogManager::registerConsoleAppender();
DLogManager::registerFileAppender();
DLogManager::registerJournalAppender();
//获取应用配置
DApplicationSettings applicationset(app);
//为了与老版本配置兼容
Expand All @@ -90,13 +93,15 @@ int main(int argc, char *argv[])
QDBusConnection dbus = QDBusConnection::sessionBus();
//如果注册失败打印出失败信息
if (!dbus.registerService("com.deepin.Calendar")) {
qWarning() << "registerService Error:" << dbus.lastError();
qCWarning(ClientLogger) << "registerService Error:" << dbus.lastError();
}
if (!dbus.registerObject("/com/deepin/Calendar", &ww)) {
qWarning() << "registerObject Error:" << dbus.lastError();
qCWarning(ClientLogger) << "registerObject Error:" << dbus.lastError();
}
ww.slotTheme(DGuiApplicationHelper::instance()->themeType());
ww.show();

qCDebug(ClientLogger) << "dde-calendar-service start";
return app->exec();
}
return 0;
Expand Down
5 changes: 3 additions & 2 deletions calendar-client/src/scheduleTask/cscheduleoperation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "cscheduleoperation.h"
#include "commondef.h"

#include "schedulectrldlg.h"
#include "configsettings.h"
Expand Down Expand Up @@ -31,7 +32,7 @@ CScheduleOperation::CScheduleOperation(const QString &scheduleTypeID, QWidget *p
{
//如果为空默认设置为本地帐户
if (m_accountItem.isNull()) {
qWarning() << "Cannot get account by schedule type,scheduleTypeID:" << scheduleTypeID;
qCWarning(ClientLogger) << "Cannot get account by schedule type,scheduleTypeID:" << scheduleTypeID;
m_accountItem = gAccountManager->getLocalAccountItem();
}
}
Expand Down Expand Up @@ -410,7 +411,7 @@ bool CScheduleOperation::isFestival(const DSchedule::Ptr &schedule)
//判断是否为节假日日程
AccountItem::Ptr account = gAccountManager->getAccountItemByScheduleTypeId(schedule->scheduleTypeID());
if (account.isNull()) {
qWarning() << "Cannot get account by schedule type,scheduleTypeID:" << schedule->scheduleTypeID();
qCWarning(ClientLogger) << "Cannot get account by schedule type,scheduleTypeID:" << schedule->scheduleTypeID();
return false;
}
DScheduleType::Ptr scheduleType = gAccountManager->getScheduleTypeByScheduleTypeId(schedule->scheduleTypeID());
Expand Down
5 changes: 3 additions & 2 deletions calendar-client/src/view/cweekdaygraphicsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "cweekdaygraphicsview.h"
#include "commondef.h"

#include "constants.h"
#include "schedulecoormanage.h"
Expand Down Expand Up @@ -94,7 +95,7 @@ void CWeekDayGraphicsview::setCurrentFocusItem(const QDate &focusDate, bool setI
m_Scene->setCurrentFocusItem(m_backgroundItem.at(static_cast<int>(offset)));
m_Scene->setIsShowCurrentItem(setItemFocus);
} else {
qWarning() << "set CurrentFocusItem Error,offset:" << offset << ",focusDate:" << focusDate << ",firstDate:" << m_backgroundItem.first()->getDate();
qCWarning(ClientLogger) << "set CurrentFocusItem Error,offset:" << offset << ",focusDate:" << focusDate << ",firstDate:" << m_backgroundItem.first()->getDate();
}
}

Expand Down Expand Up @@ -157,7 +158,7 @@ void CWeekDayGraphicsview::setSceneCurrentItemFocus(const QDate &focusDate)
m_Scene->setCurrentFocusItem(m_backgroundItem.at(offset));
m_Scene->currentFocusItemUpdate();
} else {
qWarning() << "Switching time range error! focusDate:" << focusDate << " first item date:" << m_backgroundItem.first()->getDate();
qCWarning(ClientLogger) << "Switching time range error! focusDate:" << focusDate << " first item date:" << m_backgroundItem.first()->getDate();
}
}

Expand Down
3 changes: 2 additions & 1 deletion calendar-client/src/view/graphicsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "scheduledlg.h"
#include "scheduledatamanage.h"
#include "schedulectrldlg.h"
#include "commondef.h"
#include "myscheduleview.h"
#include "constants.h"

Expand Down Expand Up @@ -198,7 +199,7 @@ void CGraphicsView::upDateInfoShow(const CGraphicsView::DragStatus &status, cons
//添加“...”item
int index = tNum - 2;
if (index < 0) {
qWarning() << "week view create error,tNum -2 :" << index;
qCWarning(ClientLogger) << "week view create error,tNum -2 :" << index;
index = 1;
}
DSchedule::Ptr tdetaliinfo(info.at(m).vData.at(index)->clone());
Expand Down
Loading

0 comments on commit f8ed8ab

Please sign in to comment.