From f8ed8ab09f8958571bdd7674b9d6e5e2680201cd Mon Sep 17 00:00:00 2001 From: myml Date: Thu, 21 Dec 2023 11:16:30 +0800 Subject: [PATCH] feat: add deepin-log config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加日志搜集相关配置 Log: --- .gitignore | 4 +- CMakeLists.txt | 2 + .../src/customWidget/jobtypelistview.cpp | 9 +- .../src/dbus/dbusaccountmanagerrequest.cpp | 7 +- .../src/dbus/dbusaccountrequest.cpp | 11 +- .../src/dbus/dbushuanglirequest.cpp | 9 +- calendar-client/src/dbus/dbusrequestbase.cpp | 5 +- calendar-client/src/dbus/dbustimedate.cpp | 5 +- calendar-client/src/dbus/doanetworkdbus.cpp | 5 +- calendar-client/src/dialog/scheduledlg.cpp | 3 +- calendar-client/src/main.cpp | 11 +- .../src/scheduleTask/cscheduleoperation.cpp | 5 +- .../src/view/cweekdaygraphicsview.cpp | 5 +- calendar-client/src/view/graphicsview.cpp | 3 +- calendar-client/src/view/monthgraphiview.cpp | 3 +- .../src/widget/calendarmainwindow.cpp | 5 +- .../src/widget/cschedulebasewidget.cpp | 2 +- .../src/widget/weekWidget/weekwindow.cpp | 3 +- calendar-common/src/commondef.h | 6 + calendar-common/src/daccount.cpp | 11 +- .../src/dcalendargeneralsettings.cpp | 3 +- calendar-common/src/dschedule.cpp | 8 +- calendar-common/src/dschedulequerypar.cpp | 5 +- calendar-common/src/dscheduletype.cpp | 7 +- calendar-common/src/dtypecolor.cpp | 3 +- .../src/alarmManager/dalarmmanager.cpp | 4 +- .../daccountmanagemodule.cpp | 8 +- .../calendarDataManager/daccountmodule.cpp | 18 +-- calendar-service/src/calendarhuangli.cpp | 2 +- .../src/dbmanager/daccountdatabase.cpp | 129 +++++++++--------- .../src/dbmanager/daccountmanagerdatabase.cpp | 31 +++-- .../src/dbmanager/ddatabasemanagement.cpp | 3 +- .../src/dbmanager/dhuanglidatabase.cpp | 7 +- calendar-service/src/dbus/dbusnotify.h | 5 +- calendar-service/src/dbus/dunioniddbus.cpp | 5 +- .../src/dbusservice/dservicemanager.cpp | 9 +- .../src/lunarandfestival/lunarcalendar.cpp | 2 +- .../src/lunarandfestival/lunarmanager.cpp | 3 +- calendar-service/src/main.cpp | 7 +- calendar-service/src/pinyin/pinyinsearch.cpp | 4 +- .../src/synchronization/dataencrypt.cpp | 20 +-- .../src/synchronization/dbuscloudsync.cpp | 3 +- .../src/synchronization/syncfilemanage.cpp | 17 +-- .../src/synchronization/syncoperation.cpp | 37 ++--- .../src/unionIDDav/dsyncdatafactory.cpp | 3 +- .../src/unionIDDav/dunioniddav.cpp | 51 +++---- linglong.yaml | 2 +- org.deepin.calendar.json | 22 +++ .../src/calendarData/dscheduledatamanager.cpp | 9 +- .../src/dbus/dbusaccountmanagerrequest.cpp | 9 +- .../src/dbus/dbusaccountrequest.cpp | 17 +-- .../src/dbus/dbushuanglirequest.cpp | 3 +- schedule-plugin/src/dbus/dbusrequestbase.cpp | 3 +- .../src/state/selectandquerystate.cpp | 4 +- .../src/task/createscheduletask.cpp | 7 +- .../src/widget/createschedulewidget.cpp | 3 +- .../test_calendardatedatamanage.cpp | 2 +- .../test_schedulecoormanage.cpp | 4 +- .../src/test_view/test_graphicsview.cpp | 2 +- .../test_method_interface.cpp | 14 +- 60 files changed, 344 insertions(+), 265 deletions(-) create mode 100644 org.deepin.calendar.json diff --git a/.gitignore b/.gitignore index b7578a652..52050bf6e 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ *.a build*/ +.linglong-target *.pro.user* *.DS_Store *.core @@ -30,4 +31,5 @@ build/ Makefile !debian/[source,changelog,compat,control,copyright,rules] CMakeLists.txt.user -*.user.* \ No newline at end of file +*.user.* +binaries diff --git a/CMakeLists.txt b/CMakeLists.txt index ed96482a8..b5ce94528 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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/) diff --git a/calendar-client/src/customWidget/jobtypelistview.cpp b/calendar-client/src/customWidget/jobtypelistview.cpp index 36c500b7a..244796ef8 100644 --- a/calendar-client/src/customWidget/jobtypelistview.cpp +++ b/calendar-client/src/customWidget/jobtypelistview.cpp @@ -4,6 +4,7 @@ #include "jobtypelistview.h" #include "cscheduleoperation.h" +#include "commondef.h" #include "scheduletypeeditdlg.h" #include "schedulectrldlg.h" #include "accountmanager.h" @@ -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); @@ -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文件 @@ -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); } diff --git a/calendar-client/src/dbus/dbusaccountmanagerrequest.cpp b/calendar-client/src/dbus/dbusaccountmanagerrequest.cpp index 03c2a1f23..cc3a11509 100644 --- a/calendar-client/src/dbus/dbusaccountmanagerrequest.cpp +++ b/calendar-client/src/dbus/dbusaccountmanagerrequest.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "dbusaccountmanagerrequest.h" +#include "commondef.h" #include #include @@ -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"方法回调事件 @@ -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") { @@ -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") { diff --git a/calendar-client/src/dbus/dbusaccountrequest.cpp b/calendar-client/src/dbus/dbusaccountrequest.cpp index fd7085b21..3c1a0c632 100644 --- a/calendar-client/src/dbus/dbusaccountrequest.cpp +++ b/calendar-client/src/dbus/dbusaccountrequest.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "dbusaccountrequest.h" +#include "commondef.h" #include #include @@ -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 scheduleReply = reply; @@ -228,7 +229,7 @@ bool DbusAccountRequest::querySchedulesByExternal(const DScheduleQueryPar::Ptr & { QDBusPendingReply reply = call("querySchedulesWithParameter", QVariant(params)); if (reply.isError()) { - qWarning() << reply.error().message(); + qCWarning(ClientLogger) << reply.error().message(); return false; } json = reply.argumentAt<0>(); @@ -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") { @@ -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") { @@ -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") { diff --git a/calendar-client/src/dbus/dbushuanglirequest.cpp b/calendar-client/src/dbus/dbushuanglirequest.cpp index 537c18824..c0ca26772 100644 --- a/calendar-client/src/dbus/dbushuanglirequest.cpp +++ b/calendar-client/src/dbus/dbushuanglirequest.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "dbushuanglirequest.h" +#include "commondef.h" #include DbusHuangLiRequest::DbusHuangLiRequest(QObject *parent) @@ -22,7 +23,7 @@ bool DbusHuangLiRequest::getFestivalMonth(quint32 year, quint32 month, FestivalI QDBusPendingReply reply = call("getFestivalMonth", QVariant(year), QVariant(month)); if (reply.isError()) { - qWarning() << reply.error().message(); + qCWarning(ClientLogger) << reply.error().message(); return false; } @@ -84,7 +85,7 @@ bool DbusHuangLiRequest::getHuangLiDay(quint32 year, quint32 month, quint32 day, QDBusPendingReply reply = call("getHuangLiDay", QVariant(year), QVariant(month), QVariant(day)); if (reply.isError()) { - qWarning() << reply.error().message(); + qCWarning(ClientLogger) << reply.error().message(); return false; } @@ -105,7 +106,7 @@ bool DbusHuangLiRequest::getHuangLiMonth(quint32 year, quint32 month, bool fill, { QDBusPendingReply 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>(); @@ -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(); diff --git a/calendar-client/src/dbus/dbusrequestbase.cpp b/calendar-client/src/dbus/dbusrequestbase.cpp index 7913f022a..a9365261f 100644 --- a/calendar-client/src/dbus/dbusrequestbase.cpp +++ b/calendar-client/src/dbus/dbusrequestbase.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "dbusrequestbase.h" +#include "commondef.h" #include DbusRequestBase::DbusRequestBase(const QString &path, const QString &interface, const QDBusConnection &connection, QObject *parent) @@ -10,11 +11,11 @@ DbusRequestBase::DbusRequestBase(const QString &path, const QString &interface, { //关联后端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(); }; } diff --git a/calendar-client/src/dbus/dbustimedate.cpp b/calendar-client/src/dbus/dbustimedate.cpp index 90d096895..718da1c14 100644 --- a/calendar-client/src/dbus/dbustimedate.cpp +++ b/calendar-client/src/dbus/dbustimedate.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "dbustimedate.h" +#include "commondef.h" #include #include @@ -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(); diff --git a/calendar-client/src/dbus/doanetworkdbus.cpp b/calendar-client/src/dbus/doanetworkdbus.cpp index f76f63f78..0f4fe6ef1 100644 --- a/calendar-client/src/dbus/doanetworkdbus.cpp +++ b/calendar-client/src/dbus/doanetworkdbus.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "doanetworkdbus.h" +#include "commondef.h" #include #include @@ -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!"; } } diff --git a/calendar-client/src/dialog/scheduledlg.cpp b/calendar-client/src/dialog/scheduledlg.cpp index e81e7a150..6e76d28fc 100644 --- a/calendar-client/src/dialog/scheduledlg.cpp +++ b/calendar-client/src/dialog/scheduledlg.cpp @@ -12,6 +12,7 @@ #include "configsettings.h" #include "accountmanager.h" #include "units.h" +#include "commondef.h" #include #include @@ -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 { diff --git a/calendar-client/src/main.cpp b/calendar-client/src/main.cpp index 4c1c1b526..b481e7625 100644 --- a/calendar-client/src/main.cpp +++ b/calendar-client/src/main.cpp @@ -9,6 +9,8 @@ #include "accessible/accessible.h" #include "tabletconfig.h" #include "schedulemanager.h" +#include "commondef.h" +#include #include #include @@ -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); @@ -78,6 +80,7 @@ int main(int argc, char *argv[]) viewtype = 2; DLogManager::registerConsoleAppender(); DLogManager::registerFileAppender(); + DLogManager::registerJournalAppender(); //获取应用配置 DApplicationSettings applicationset(app); //为了与老版本配置兼容 @@ -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; diff --git a/calendar-client/src/scheduleTask/cscheduleoperation.cpp b/calendar-client/src/scheduleTask/cscheduleoperation.cpp index 681c3ed41..62579759c 100644 --- a/calendar-client/src/scheduleTask/cscheduleoperation.cpp +++ b/calendar-client/src/scheduleTask/cscheduleoperation.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "cscheduleoperation.h" +#include "commondef.h" #include "schedulectrldlg.h" #include "configsettings.h" @@ -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(); } } @@ -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()); diff --git a/calendar-client/src/view/cweekdaygraphicsview.cpp b/calendar-client/src/view/cweekdaygraphicsview.cpp index 4412fef4a..2777995c5 100644 --- a/calendar-client/src/view/cweekdaygraphicsview.cpp +++ b/calendar-client/src/view/cweekdaygraphicsview.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "cweekdaygraphicsview.h" +#include "commondef.h" #include "constants.h" #include "schedulecoormanage.h" @@ -94,7 +95,7 @@ void CWeekDayGraphicsview::setCurrentFocusItem(const QDate &focusDate, bool setI m_Scene->setCurrentFocusItem(m_backgroundItem.at(static_cast(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(); } } @@ -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(); } } diff --git a/calendar-client/src/view/graphicsview.cpp b/calendar-client/src/view/graphicsview.cpp index f3b1655a1..35719b704 100644 --- a/calendar-client/src/view/graphicsview.cpp +++ b/calendar-client/src/view/graphicsview.cpp @@ -8,6 +8,7 @@ #include "scheduledlg.h" #include "scheduledatamanage.h" #include "schedulectrldlg.h" +#include "commondef.h" #include "myscheduleview.h" #include "constants.h" @@ -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()); diff --git a/calendar-client/src/view/monthgraphiview.cpp b/calendar-client/src/view/monthgraphiview.cpp index e3e89a0da..6dd4871ab 100644 --- a/calendar-client/src/view/monthgraphiview.cpp +++ b/calendar-client/src/view/monthgraphiview.cpp @@ -8,6 +8,7 @@ #include "../dialog/myscheduleview.h" #include "../widget/touchgestureoperation.h" #include "constants.h" +#include "commondef.h" #include "graphicsItem/cmonthschedulenumitem.h" #include "cscenetabkeydeal.h" #include "ckeyenabledeal.h" @@ -434,7 +435,7 @@ void CMonthGraphicsview::setSceneCurrentItemFocus(const QDate &focusDate) m_Scene->setCurrentFocusItem(m_DayItem.at(offset)); m_Scene->currentFocusItemUpdate(); } else { - qWarning() << "Switching time range error! focusDate:" << focusDate << " first item date:" << m_DayItem.first()->getDate(); + qCWarning(ClientLogger) << "Switching time range error! focusDate:" << focusDate << " first item date:" << m_DayItem.first()->getDate(); } } diff --git a/calendar-client/src/widget/calendarmainwindow.cpp b/calendar-client/src/widget/calendarmainwindow.cpp index a2cde489a..5634ce30f 100644 --- a/calendar-client/src/widget/calendarmainwindow.cpp +++ b/calendar-client/src/widget/calendarmainwindow.cpp @@ -27,6 +27,7 @@ #include "scheduletypeeditdlg.h" #include "accountmanager.h" #include "units.h" +#include "commondef.h" #include #include @@ -201,7 +202,7 @@ void Calendarmainwindow::slotSetSearchFocus() void Calendarmainwindow::viewWindow(int type, const bool showAnimation) { if (type < 0 || type >= m_stackWidget->count()) { - qWarning() << "set view error,set index:" << type; + qCWarning(ClientLogger) << "set view error,set index:" << type; return; } if (showAnimation) { @@ -502,7 +503,7 @@ void Calendarmainwindow::createview() //如果默认视图不在范围内则设置为月窗口显示 if (m_defaultIndex < 0 || m_defaultIndex >= m_stackWidget->count()) { m_defaultIndex = 1; - qWarning() << "set default view index beyond,index:" << m_defaultIndex; + qCWarning(ClientLogger) << "set default view index beyond,index:" << m_defaultIndex; } m_stackWidget->setCurrentIndex(m_defaultIndex); m_buttonBox->button(m_defaultIndex)->setChecked(true); diff --git a/calendar-client/src/widget/cschedulebasewidget.cpp b/calendar-client/src/widget/cschedulebasewidget.cpp index 34238bffc..38b310007 100644 --- a/calendar-client/src/widget/cschedulebasewidget.cpp +++ b/calendar-client/src/widget/cschedulebasewidget.cpp @@ -127,7 +127,7 @@ void CScheduleBaseWidget::updateDBusData() // //更新日程信息 //// _task->updateInfo(_startDate, _stopDate, getShowLunar()); // } else { -// qWarning() << "startDate or stopDate Err!"; +// qCWarning(ClientLogger) << "startDate or stopDate Err!"; // } // } } diff --git a/calendar-client/src/widget/weekWidget/weekwindow.cpp b/calendar-client/src/widget/weekWidget/weekwindow.cpp index 265f0ec4b..801c6453d 100644 --- a/calendar-client/src/widget/weekWidget/weekwindow.cpp +++ b/calendar-client/src/widget/weekWidget/weekwindow.cpp @@ -7,6 +7,7 @@ #include "constants.h" #include "weekheadview.h" #include "weekview.h" +#include "commondef.h" #include "schedulesearchview.h" #include "todaybutton.h" #include @@ -292,7 +293,7 @@ void CWeekWindow::updateShowDate(const bool isUpdateBar) m_stopDate = _weekShowData.last(); //如果时间无效则打印log if (m_startDate.isNull() || m_stopDate.isNull()) { - qWarning() << "week start or stop date error"; + qCWarning(ClientLogger) << "week start or stop date error"; } //设置全天和非全天显示时间范围 m_scheduleView->setRange(m_startDate, m_stopDate); diff --git a/calendar-common/src/commondef.h b/calendar-common/src/commondef.h index 58540dd78..df15f58de 100644 --- a/calendar-common/src/commondef.h +++ b/calendar-common/src/commondef.h @@ -7,8 +7,14 @@ #include #include +#include const QString CalendarServiceName = "com.deepin.dataserver.Calendar"; const QString CalendarPath = "/com/deepin/dataserver/Calendar"; +const QLoggingCategory CommonLogger("org.deepin.dde-calendar.common"); +const QLoggingCategory ClientLogger("org.deepin.dde-calendar.client"); +const QLoggingCategory ServiceLogger("org.deepin.dde-calendar.service"); + + #endif // COMMONDEF_H diff --git a/calendar-common/src/daccount.cpp b/calendar-common/src/daccount.cpp index a6a79a3fe..5ff32a41f 100644 --- a/calendar-common/src/daccount.cpp +++ b/calendar-common/src/daccount.cpp @@ -5,6 +5,7 @@ #include "daccount.h" #include "units.h" +#include "commondef.h" #include #include @@ -167,7 +168,7 @@ void DAccount::setDtUpdate(const QDateTime &dtUpdate) bool DAccount::toJsonString(const DAccount::Ptr &account, QString &jsonStr) { if (account.isNull()) { - qWarning() << "hold a reference to a null pointer."; + qCWarning(CommonLogger) << "hold a reference to a null pointer."; return false; } QJsonObject rootObj; @@ -202,7 +203,7 @@ bool DAccount::fromJsonString(Ptr &account, const QString &jsonStr) QJsonParseError jsonError; QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonStr.toLocal8Bit(), &jsonError)); if (jsonError.error != QJsonParseError::NoError) { - qWarning() << "error:" << jsonError.errorString(); + qCWarning(CommonLogger) << "error:" << jsonError.errorString(); return false; } QJsonObject rootObj = jsonDoc.object(); @@ -283,7 +284,7 @@ bool DAccount::fromJsonListString(List &accountList, const QString &jsonStr) QJsonParseError jsonError; QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonStr.toLocal8Bit(), &jsonError)); if (jsonError.error != QJsonParseError::NoError) { - qWarning() << "error:" << jsonError.errorString(); + qCWarning(CommonLogger) << "error:" << jsonError.errorString(); return false; } QJsonObject rootObj = jsonDoc.object(); @@ -296,7 +297,7 @@ bool DAccount::fromJsonListString(List &accountList, const QString &jsonStr) if (fromJsonString(account, strAcc)) { accountList.append(account); } else { - qWarning() << "format failed:" << strAcc; + qCWarning(CommonLogger) << "format failed:" << strAcc; } } } @@ -388,7 +389,7 @@ void DAccount::syncFreqFromJsonString(const DAccount::Ptr &account, const QStrin QJsonParseError jsonError; QJsonDocument jsonDoc(QJsonDocument::fromJson(syncFreqStr.toLocal8Bit(), &jsonError)); if (jsonError.error != QJsonParseError::NoError) { - qWarning() << "error:" << jsonError.errorString(); + qCWarning(CommonLogger) << "error:" << jsonError.errorString(); return; } QJsonObject rootObj = jsonDoc.object(); diff --git a/calendar-common/src/dcalendargeneralsettings.cpp b/calendar-common/src/dcalendargeneralsettings.cpp index 6e27a6f25..71a74fd7d 100644 --- a/calendar-common/src/dcalendargeneralsettings.cpp +++ b/calendar-common/src/dcalendargeneralsettings.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "dcalendargeneralsettings.h" +#include "commondef.h" #include #include @@ -61,7 +62,7 @@ bool DCalendarGeneralSettings::fromJsonString(Ptr &cgSet, const QString &jsonStr QJsonParseError jsonError; QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonStr.toLocal8Bit(), &jsonError)); if (jsonError.error != QJsonParseError::NoError) { - qWarning() << "error:" << jsonError.errorString(); + qCWarning(CommonLogger) << "error:" << jsonError.errorString(); return false; } diff --git a/calendar-common/src/dschedule.cpp b/calendar-common/src/dschedule.cpp index 7ed79e337..f9f1b2873 100644 --- a/calendar-common/src/dschedule.cpp +++ b/calendar-common/src/dschedule.cpp @@ -3,10 +3,12 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "dschedule.h" +#include "commondef.h" #include "icalformat.h" #include "memorycalendar.h" #include "units.h" +#include "commondef.h" #include @@ -231,7 +233,7 @@ bool DSchedule::fromJsonString(DSchedule::Ptr &schedule, const QString &json) QJsonParseError jsonError; QJsonDocument jsonDoc(QJsonDocument::fromJson(json.toLocal8Bit(), &jsonError)); if (jsonError.error != QJsonParseError::NoError) { - qWarning() << "error:" << jsonError.errorString(); + qCWarning(CommonLogger) << "error:" << jsonError.errorString(); return false; } bool resBool = false; @@ -254,7 +256,7 @@ bool DSchedule::fromJsonString(DSchedule::Ptr &schedule, const QString &json) bool DSchedule::toJsonString(const DSchedule::Ptr &schedule, QString &json) { if (schedule.isNull()) { - qWarning() << "hold a reference to a null pointer."; + qCWarning(CommonLogger) << "hold a reference to a null pointer."; return false; } QJsonObject rootObject; @@ -297,7 +299,7 @@ QMap DSchedule::fromMapString(const QString &json) QJsonParseError jsonError; QJsonDocument jsonDoc(QJsonDocument::fromJson(json.toLocal8Bit(), &jsonError)); if (jsonError.error != QJsonParseError::NoError) { - qWarning() << "error:" << jsonError.errorString(); + qCWarning(CommonLogger) << "error:" << jsonError.errorString(); return scheduleMap; } QJsonArray rootArray = jsonDoc.array(); diff --git a/calendar-common/src/dschedulequerypar.cpp b/calendar-common/src/dschedulequerypar.cpp index 24ea1213a..786115296 100644 --- a/calendar-common/src/dschedulequerypar.cpp +++ b/calendar-common/src/dschedulequerypar.cpp @@ -5,6 +5,7 @@ #include "dschedulequerypar.h" #include "units.h" +#include "commondef.h" #include #include @@ -53,7 +54,7 @@ DScheduleQueryPar::Ptr DScheduleQueryPar::fromJsonString(const QString &queryStr QJsonParseError jsonError; QJsonDocument jsonDoc(QJsonDocument::fromJson(queryStr.toLocal8Bit(), &jsonError)); if (jsonError.error != QJsonParseError::NoError) { - qWarning() << "error:" << jsonError.errorString() << " queryStr:" << queryStr; + qCWarning(CommonLogger) << "error:" << jsonError.errorString() << " queryStr:" << queryStr; return nullptr; } DScheduleQueryPar::Ptr queryPar = DScheduleQueryPar::Ptr(new DScheduleQueryPar); @@ -92,7 +93,7 @@ DScheduleQueryPar::Ptr DScheduleQueryPar::fromJsonString(const QString &queryStr QString DScheduleQueryPar::toJsonString(const DScheduleQueryPar::Ptr &queryPar) { if (queryPar.isNull()) { - qWarning() << "hold a reference to a null pointer."; + qCWarning(CommonLogger) << "hold a reference to a null pointer."; return QString(); } QJsonObject jsonObj; diff --git a/calendar-common/src/dscheduletype.cpp b/calendar-common/src/dscheduletype.cpp index e1064144b..858549ef8 100644 --- a/calendar-common/src/dscheduletype.cpp +++ b/calendar-common/src/dscheduletype.cpp @@ -6,6 +6,7 @@ #include "daccount.h" #include "units.h" +#include "commondef.h" #include #include @@ -191,7 +192,7 @@ bool DScheduleType::fromJsonString(DScheduleType::Ptr &scheduleType, const QStri QJsonParseError jsonError; QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonStr.toLocal8Bit(), &jsonError)); if (jsonError.error != QJsonParseError::NoError) { - qWarning() << "error:" << jsonError.errorString(); + qCWarning(CommonLogger) << "error:" << jsonError.errorString(); return false; } QJsonObject rootObj = jsonDoc.object(); @@ -263,7 +264,7 @@ bool DScheduleType::fromJsonString(DScheduleType::Ptr &scheduleType, const QStri bool DScheduleType::toJsonString(const DScheduleType::Ptr &scheduleType, QString &jsonStr) { if (scheduleType.isNull()) { - qWarning() << "hold a reference to a null pointer."; + qCWarning(CommonLogger) << "hold a reference to a null pointer."; return false; } //序列化 @@ -299,7 +300,7 @@ bool DScheduleType::fromJsonListString(DScheduleType::List &stList, const QStrin QJsonParseError jsonError; QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonStr.toLocal8Bit(), &jsonError)); if (jsonError.error != QJsonParseError::NoError) { - qWarning() << "error:" << jsonError.errorString(); + qCWarning(CommonLogger) << "error:" << jsonError.errorString(); return false; } QJsonObject rootObj = jsonDoc.object(); diff --git a/calendar-common/src/dtypecolor.cpp b/calendar-common/src/dtypecolor.cpp index 370de5a8e..4c3727246 100644 --- a/calendar-common/src/dtypecolor.cpp +++ b/calendar-common/src/dtypecolor.cpp @@ -5,6 +5,7 @@ #include "dtypecolor.h" #include "units.h" +#include "commondef.h" #include #include @@ -72,7 +73,7 @@ DTypeColor::List DTypeColor::fromJsonString(const QString &colorJson) QJsonParseError jsonError; QJsonDocument jsonDoc(QJsonDocument::fromJson(colorJson.toLocal8Bit(), &jsonError)); if (jsonError.error != QJsonParseError::NoError) { - qWarning() << "error:" << jsonError.errorString(); + qCWarning(CommonLogger) << "error:" << jsonError.errorString(); return colorList; } QJsonArray rootArr = jsonDoc.array(); diff --git a/calendar-service/src/alarmManager/dalarmmanager.cpp b/calendar-service/src/alarmManager/dalarmmanager.cpp index 9cbe88383..5d6217daf 100644 --- a/calendar-service/src/alarmManager/dalarmmanager.cpp +++ b/calendar-service/src/alarmManager/dalarmmanager.cpp @@ -135,7 +135,7 @@ int DAlarmManager::remindJob(const DRemindData::Ptr &remindData, const DSchedule { //如果没有提醒 if (schedule->alarms().size() == 0) { - qWarning() << "remind job failed id=%1" << schedule->uid(); + qCWarning(ServiceLogger) << "remind job failed id=%1" << schedule->uid(); return 0; } @@ -196,7 +196,7 @@ int DAlarmManager::remindJob(const DRemindData::Ptr &remindData, const DSchedule qint32 timeout = 0; QList argumentList; argumentList << appname << replaces_id << appicon << title << body << actionlist << hints << timeout; - qDebug() << __FUNCTION__ << QString("remind now: %1, title:" + qCDebug(ServiceLogger) << __FUNCTION__ << QString("remind now: %1, title:" " %2, body: %3") .arg(QDateTime::currentDateTime().toString()) .arg(title) diff --git a/calendar-service/src/calendarDataManager/daccountmanagemodule.cpp b/calendar-service/src/calendarDataManager/daccountmanagemodule.cpp index 20d3ae4e8..180049c56 100644 --- a/calendar-service/src/calendarDataManager/daccountmanagemodule.cpp +++ b/calendar-service/src/calendarDataManager/daccountmanagemodule.cpp @@ -3,7 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "daccountmanagemodule.h" - +#include "commondef.h" #include "units.h" #include "calendarprogramexitcontrol.h" #include @@ -40,7 +40,7 @@ DAccountManageModule::DAccountManageModule(QObject *parent) m_accountModuleMap[account->accountID()] = accountModule; DAccountService::Ptr accountService = DAccountService::Ptr(new DAccountService(account->dbusPath(), account->dbusInterface(), accountModule, this)); if (!sessionBus.registerObject(accountService->getPath(), accountService->getInterface(), accountService.data(), options)) { - qWarning() << "registerObject accountService failed:" << sessionBus.lastError(); + qCWarning(ServiceLogger) << "registerObject accountService failed:" << sessionBus.lastError(); } else { m_AccountServiceMap[account->accountType()].insert(account->accountID(), accountService); //如果是网络帐户则开启定时下载任务 @@ -357,7 +357,7 @@ void DAccountManageModule::slotUidLoginStatueChange(const int status) //登陆成功 DAccount::Ptr accountUnionid = m_syncFileManage->getuserInfo(); if (accountUnionid.isNull() || accountUnionid->accountName().isEmpty()) { - qWarning() << "Error getting account information"; + qCWarning(ServiceLogger) << "Error getting account information"; oldStatus.removeAt(oldStatus.indexOf(1)); return; } @@ -368,7 +368,7 @@ void DAccountManageModule::slotUidLoginStatueChange(const int status) m_accountModuleMap[accountUnionid->accountID()] = accountModule; DAccountService::Ptr accountService = DAccountService::Ptr(new DAccountService(accountUnionid->dbusPath(), accountUnionid->dbusInterface(), accountModule, this)); if (!sessionBus.registerObject(accountService->getPath(), accountService->getInterface(), accountService.data(), options)) { - qWarning() << "registerObject accountService failed:" << sessionBus.lastError(); + qCWarning(ServiceLogger) << "registerObject accountService failed:" << sessionBus.lastError(); } else { m_AccountServiceMap[accountUnionid->accountType()].insert(accountUnionid->accountID(), accountService); if (accountUnionid->accountState().testFlag(DAccount::Account_Open)) { diff --git a/calendar-service/src/calendarDataManager/daccountmodule.cpp b/calendar-service/src/calendarDataManager/daccountmodule.cpp index b77763ca7..a9103c87e 100644 --- a/calendar-service/src/calendarDataManager/daccountmodule.cpp +++ b/calendar-service/src/calendarDataManager/daccountmodule.cpp @@ -215,7 +215,7 @@ bool DAccountModule::deleteScheduleTypeByID(const QString &typeID) } } if (scheduleType.isNull()) { - qWarning() << "scheduleType isNull, typeID:" << typeID; + qCWarning(ServiceLogger) << "scheduleType isNull, typeID:" << typeID; return false; } @@ -239,7 +239,7 @@ bool DAccountModule::updateScheduleType(const QString &typeInfo) DScheduleType::Ptr oldScheduleType = m_accountDB->getScheduleTypeByID(scheduleType->typeID()); //如果颜色有改动 if (oldScheduleType.isNull()) { - qWarning() << "get oldScheduleType error,typeID:" << scheduleType->typeID(); + qCWarning(ServiceLogger) << "get oldScheduleType error,typeID:" << scheduleType->typeID(); } else { if (oldScheduleType->typeColor() != scheduleType->typeColor()) { if (!oldScheduleType->typeColor().isSysColorInfo()) { @@ -649,7 +649,7 @@ void DAccountModule::remindJob(const QString &alarmID) void DAccountModule::accountDownload() { if (m_dataSync != nullptr) { - qInfo() << "开始下载数据"; + qCInfo(ServiceLogger) << "开始下载数据"; m_dataSync->syncData(this->account()->accountID(), this->account()->accountName(), (int)this->account()->accountState(), DDataSyncBase::Sync_Upload | DDataSyncBase::Sync_Download); } } @@ -657,7 +657,7 @@ void DAccountModule::accountDownload() void DAccountModule::uploadNetWorkAccountData() { if (m_dataSync != nullptr) { - qInfo() << "开始上传数据"; + qCInfo(ServiceLogger) << "开始上传数据"; m_dataSync->syncData(this->account()->accountID(), this->account()->accountName(), (int)this->account()->accountState(), DDataSyncBase::Sync_Upload); } } @@ -913,7 +913,7 @@ void DAccountModule::slotOpenCalendar(const QString &alarmID) this); DRemindData::Ptr remindData = m_accountDB->getRemindData(alarmID); if (remindData.isNull()) { - qWarning() << "No corresponding reminder ID found"; + qCWarning(ServiceLogger) << "No corresponding reminder ID found"; return; } DSchedule::Ptr schedule = getScheduleByRemind(remindData); @@ -944,7 +944,7 @@ void DAccountModule::slotSyncState(const int syncState) m_account->setSyncState(DAccount::Sync_StorageFull); break; default: - qWarning()<<"syncState:"<setSyncState(DAccount::Sync_ServerException); break; @@ -983,14 +983,14 @@ bool DAccountModule::importSchedule(const QString &icsFilePath, const QString &t KCalendarCore::MemoryCalendar::Ptr cal(new KCalendarCore::MemoryCalendar(timezone)); auto ok = icalformat.load(cal, icsFilePath); if (!ok) { - qWarning() << "can not load ics file from" << icsFilePath; + qCWarning(ServiceLogger) << "can not load ics file from" << icsFilePath; return false; } auto events = cal->events(); if (cleanExists) { ok = m_accountDB->deleteSchedulesByScheduleTypeID(typeID, true); if (!ok) { - qWarning() << "can not clean schedules from" << typeID; + qCWarning(ServiceLogger) << "can not clean schedules from" << typeID; return false; } }; @@ -998,7 +998,7 @@ bool DAccountModule::importSchedule(const QString &icsFilePath, const QString &t auto data = event.data(); auto sch = DSchedule::Ptr(new DSchedule(*data)); sch->setScheduleTypeID(typeID); - qInfo() << "import schedule" << event.data()->dtStart().toString() + qCInfo(ServiceLogger) << "import schedule" << event.data()->dtStart().toString() << event.data()->summary() << m_accountDB->createSchedule(sch); }; // 发送日程更新信号 diff --git a/calendar-service/src/calendarhuangli.cpp b/calendar-service/src/calendarhuangli.cpp index 62fadf39a..b7b4f10c8 100644 --- a/calendar-service/src/calendarhuangli.cpp +++ b/calendar-service/src/calendarhuangli.cpp @@ -73,7 +73,7 @@ QString CalendarHuangLi::getHuangLiMonth(quint32 year, quint32 month, bool fill) hldayinfo.mZodiac = lunardayinfo.Zodiac; hldayinfo.mWorktime = lunardayinfo.Worktime; monthinfo.mCaLunarDayInfo.append(hldayinfo); -// qDebug() << hldayinfo.mGanZhiYear << hldayinfo.mGanZhiMonth << hldayinfo.mGanZhiDay +// qCDebug(ServiceLogger) << hldayinfo.mGanZhiYear << hldayinfo.mGanZhiMonth << hldayinfo.mGanZhiDay // << hldayinfo.mLunarDayName << hldayinfo.mLunarFestival << hldayinfo.mLunarFestival // << hldayinfo.mLunarLeapMonth << hldayinfo.mLunarMonthName << hldayinfo.mSolarFestival // << hldayinfo.mTerm << hldayinfo.mZodiac << hldayinfo.mWorktime; diff --git a/calendar-service/src/dbmanager/daccountdatabase.cpp b/calendar-service/src/dbmanager/daccountdatabase.cpp index 5f244c0dc..62d8a0a97 100644 --- a/calendar-service/src/dbmanager/daccountdatabase.cpp +++ b/calendar-service/src/dbmanager/daccountdatabase.cpp @@ -4,6 +4,7 @@ #include "daccountdatabase.h" +#include "commondef.h" #include "units.h" #include "pinyin/pinyinsearch.h" @@ -48,19 +49,19 @@ QString DAccountDataBase::createSchedule(const DSchedule::Ptr &schedule) query.addBindValue(0); if (!query.exec()) { schedule->setUid(""); - qWarning() << "createSchedule error:" << query.lastError(); + qCWarning(ServiceLogger) << "createSchedule error:" << query.lastError(); } if (query.isActive()) { query.finish(); } } else { schedule->setUid(""); - qWarning() << "createSchedule error:" << query.lastError(); + qCWarning(ServiceLogger) << "createSchedule error:" << query.lastError(); } } else { schedule->setUid(""); - qWarning() << "schedule is null"; + qCWarning(ServiceLogger) << "schedule is null"; } return schedule->uid(); @@ -92,13 +93,13 @@ bool DAccountDataBase::updateSchedule(const DSchedule::Ptr &schedule) if (query.exec()) { resbool = true; } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { query.finish(); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } } @@ -122,14 +123,14 @@ DSchedule::Ptr DAccountDataBase::getScheduleByScheduleID(const QString &schedule schedule->setScheduleTypeID(query.value("scheduleTypeID").toString()); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); return schedule; } if (query.isActive()) { query.finish(); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); return schedule; } @@ -148,13 +149,13 @@ QStringList DAccountDataBase::getScheduleIDListByTypeID(const QString &typeID) scheduleIDList.append(query.value("scheduleID").toString()); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { query.finish(); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } return scheduleIDList; @@ -175,7 +176,7 @@ bool DAccountDataBase::deleteScheduleByScheduleID(const QString &scheduleID, con resBool = query.exec(); } if (!resBool) { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { @@ -201,7 +202,7 @@ bool DAccountDataBase::deleteSchedulesByScheduleTypeID(const QString &typeID, co } if (!resBool) { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { @@ -250,10 +251,10 @@ DSchedule::List DAccountDataBase::querySchedulesByKey(const QString &key) scheduleList.append(schedule); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { @@ -293,10 +294,10 @@ DSchedule::List DAccountDataBase::querySchedulesByRRule(const QString &key, cons } } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { @@ -321,10 +322,10 @@ DSchedule::List DAccountDataBase::getRemindSchedule() scheduleList.append(schedule); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { @@ -374,11 +375,11 @@ QString DAccountDataBase::createScheduleType(const DScheduleType::Ptr &scheduleT query.addBindValue(scheduleType->deleted()); if (!query.exec()) { - qWarning() << __FUNCTION__ << query.lastError(); + qCWarning(ServiceLogger) << __FUNCTION__ << query.lastError(); scheduleType->setTypeID(""); } } else { - qWarning() << __FUNCTION__ << query.lastError(); + qCWarning(ServiceLogger) << __FUNCTION__ << query.lastError(); scheduleType->setTypeID(""); } @@ -429,7 +430,7 @@ DScheduleType::Ptr DAccountDataBase::getScheduleTypeByID(const QString &typeID, systemTypeTran(type); } } else { - qWarning() << query.lastError(); + qCWarning(ServiceLogger) << query.lastError(); } query.addBindValue(typeID); query.addBindValue(isDeleted); @@ -482,10 +483,10 @@ DScheduleType::List DAccountDataBase::getScheduleTypeList(const int isDeleted) typeList.append(type); } } else { - qWarning() << "getScheduleTypeList error:" << query.lastError(); + qCWarning(ServiceLogger) << "getScheduleTypeList error:" << query.lastError(); } } else { - qWarning() << "getScheduleTypeList error:" << query.lastError(); + qCWarning(ServiceLogger) << "getScheduleTypeList error:" << query.lastError(); } if (query.isActive()) { @@ -507,7 +508,7 @@ bool DAccountDataBase::scheduleTypeByUsed(const QString &typeID, const int isDel typeCount = query.value(0).toInt(); } } else { - qWarning() << query.lastError(); + qCWarning(ServiceLogger) << query.lastError(); } if (query.isActive()) { @@ -534,13 +535,13 @@ bool DAccountDataBase::deleteScheduleTypeByID(const QString &typeID, const int i query.addBindValue(typeID); res = query.exec(); if (!res) { - qWarning() << "DELETE scheduleType error by typeID:" << typeID << " " << query.lastError(); + qCWarning(ServiceLogger) << "DELETE scheduleType error by typeID:" << typeID << " " << query.lastError(); } if (query.isActive()) { query.finish(); } } else { - qWarning() << "DELETE scheduleType error by typeID:" << typeID << " " << query.lastError(); + qCWarning(ServiceLogger) << "DELETE scheduleType error by typeID:" << typeID << " " << query.lastError(); } return res; @@ -569,10 +570,10 @@ bool DAccountDataBase::updateScheduleType(const DScheduleType::Ptr &scheduleType if (query.exec()) { res = true; } else { - qWarning() << "updateScheduleType error:" << query.lastError(); + qCWarning(ServiceLogger) << "updateScheduleType error:" << query.lastError(); } } else { - qWarning() << "updateScheduleType error:" << query.lastError(); + qCWarning(ServiceLogger) << "updateScheduleType error:" << query.lastError(); } if (query.isActive()) { @@ -592,11 +593,11 @@ QString DAccountDataBase::getFestivalTypeID() typeID = query.value("typeID").toString(); } } else { - qWarning() << "updateScheduleType error:" << query.lastError(); + qCWarning(ServiceLogger) << "updateScheduleType error:" << query.lastError(); } } else { - qWarning() << "updateScheduleType error:" << query.lastError(); + qCWarning(ServiceLogger) << "updateScheduleType error:" << query.lastError(); } if (query.isActive()) { query.finish(); @@ -625,7 +626,7 @@ void DAccountDataBase::getAccountInfo(const DAccount::Ptr &account) account->setIsExpandDisplay(query.value("expandStatus").toBool()); account->setDtLastSync(dtFromString(query.value("dtLastUpdate").toString())); } else { - qWarning() << query.lastError(); + qCWarning(ServiceLogger) << query.lastError(); } if (query.isActive()) { query.finish(); @@ -652,10 +653,10 @@ void DAccountDataBase::updateAccountInfo() query.addBindValue(m_account->isExpandDisplay()); query.addBindValue(dtToString(m_account->dtLastSync())); if (!query.exec()) { - qWarning() << query.lastError(); + qCWarning(ServiceLogger) << query.lastError(); } } else { - qWarning() << query.lastError(); + qCWarning(ServiceLogger) << query.lastError(); } if (query.isActive()) { @@ -694,10 +695,10 @@ bool DAccountDataBase::addTypeColor(DTypeColor &typeColor) if (query.exec()) { res = true; } else { - qWarning() << __FUNCTION__ << query.lastError(); + qCWarning(ServiceLogger) << __FUNCTION__ << query.lastError(); } } else { - qWarning() << __FUNCTION__ << query.lastError(); + qCWarning(ServiceLogger) << __FUNCTION__ << query.lastError(); } if (query.isActive()) { @@ -713,10 +714,10 @@ void DAccountDataBase::deleteTypeColor(const QString &colorNo) if (query.prepare(strSql)) { query.addBindValue(colorNo); if (!query.exec()) { - qWarning() << __FUNCTION__ << query.lastError(); + qCWarning(ServiceLogger) << __FUNCTION__ << query.lastError(); } } else { - qWarning() << __FUNCTION__ << query.lastError(); + qCWarning(ServiceLogger) << __FUNCTION__ << query.lastError(); } if (query.isActive()) { @@ -740,7 +741,7 @@ DTypeColor::List DAccountDataBase::getSysColor() typeColorList.append(color); } } else { - qWarning() << __FUNCTION__ << query.lastError(); + qCWarning(ServiceLogger) << __FUNCTION__ << query.lastError(); } if (query.isActive()) { query.finish(); @@ -766,10 +767,10 @@ void DAccountDataBase::createRemindInfo(const DRemindData::Ptr &remind) query.addBindValue(dtToString(remind->dtStart())); query.addBindValue(dtToString(remind->dtEnd())); if (!query.exec()) { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } } @@ -790,10 +791,10 @@ void DAccountDataBase::updateRemindInfo(const DRemindData::Ptr &remind) query.addBindValue(dtToString(remind->dtEnd())); query.addBindValue(remind->alarmID()); if (!query.exec()) { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } } @@ -804,10 +805,10 @@ void DAccountDataBase::deleteRemindInfoByAlarmID(const QString &alarmID) if (query.prepare(strSql)) { query.addBindValue(alarmID); if (!query.exec()) { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { @@ -837,10 +838,10 @@ DRemindData::Ptr DAccountDataBase::getRemindData(const QString &alarmID) remindData->setRecurrenceId(dtFromString(query.value("recurID").toString())); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { @@ -873,10 +874,10 @@ DRemindData::List DAccountDataBase::getValidRemindJob() remindList.append(remindData); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { @@ -894,7 +895,7 @@ void DAccountDataBase::clearRemindJobDatabase() query.finish(); } } else { - qWarning() << __FUNCTION__ << query.lastError(); + qCWarning(ServiceLogger) << __FUNCTION__ << query.lastError(); } } @@ -921,10 +922,10 @@ DRemindData::List DAccountDataBase::getRemindByScheduleID(const QString &schedul remindList.append(remindData); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { @@ -947,10 +948,10 @@ void DAccountDataBase::addUploadTask(const DUploadTaskData::Ptr &uploadTask) query.addBindValue(uploadTask->objectId()); query.addBindValue(dtToString(QDateTime::currentDateTime())); if (!query.exec()) { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { @@ -975,7 +976,7 @@ DUploadTaskData::List DAccountDataBase::getUploadTask() uploadList.append(upload); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { query.finish(); @@ -990,10 +991,10 @@ void DAccountDataBase::deleteUploadTask(const QString &taskID) if (query.prepare(strSql)) { query.addBindValue(taskID); if (!query.exec()) { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { @@ -1013,7 +1014,7 @@ void DAccountDataBase::createDB() } //将权限修改为600(对文件的所有者可以读写,其他用户不可读不可写) if (!file.setPermissions(QFile::WriteOwner | QFile::ReadOwner)) { - qWarning() << "permissions cannot be modified,error:" << file.errorString(); + qCWarning(ServiceLogger) << "permissions cannot be modified,error:" << file.errorString(); } if (m_database.open()) { SqliteQuery query(m_database); @@ -1021,37 +1022,37 @@ void DAccountDataBase::createDB() //帐户信息表 res = query.exec(sql_create_account); if (!res) { - qWarning() << "account create failed.error:" << query.lastError(); + qCWarning(ServiceLogger) << "account create failed.error:" << query.lastError(); } //日程表 res = query.exec(sql_create_schedules); if (!res) { - qWarning() << "schedules create failed.error:" << query.lastError(); + qCWarning(ServiceLogger) << "schedules create failed.error:" << query.lastError(); } //类型表 res = query.exec(sql_create_scheduleType); if (!res) { - qWarning() << "scheduleType create failed.error:" << query.lastError(); + qCWarning(ServiceLogger) << "scheduleType create failed.error:" << query.lastError(); } //颜色表 res = query.exec(sql_create_typeColor); if (!res) { - qWarning() << "typeColorSql create failed.error:" << query.lastError(); + qCWarning(ServiceLogger) << "typeColorSql create failed.error:" << query.lastError(); } //创建上传任务表 res = query.exec(sql_create_uploadTask); if (!res) { - qWarning() << "uploadTask create failed.error:" << query.lastError(); + qCWarning(ServiceLogger) << "uploadTask create failed.error:" << query.lastError(); } //创建提醒任务表 res = query.exec(sql_create_remindTask); if (!res) { - qWarning() << "remindTask create failed.error:" << query.lastError(); + qCWarning(ServiceLogger) << "remindTask create failed.error:" << query.lastError(); } if (query.isActive()) { @@ -1187,10 +1188,10 @@ void DAccountDataBase::initAccountDB() query.addBindValue(m_account->syncTag()); query.addBindValue(m_account->isExpandDisplay()); if (!query.exec()) { - qWarning() << "initAccountDB error:" << query.lastError(); + qCWarning(ServiceLogger) << "initAccountDB error:" << query.lastError(); } } else { - qWarning() << "initAccountDB error:" << query.lastError(); + qCWarning(ServiceLogger) << "initAccountDB error:" << query.lastError(); } if (query.isActive()) { diff --git a/calendar-service/src/dbmanager/daccountmanagerdatabase.cpp b/calendar-service/src/dbmanager/daccountmanagerdatabase.cpp index 8a504127d..65280ef7c 100644 --- a/calendar-service/src/dbmanager/daccountmanagerdatabase.cpp +++ b/calendar-service/src/dbmanager/daccountmanagerdatabase.cpp @@ -6,6 +6,7 @@ #include "units.h" +#include "commondef.h" #include #include #include @@ -48,7 +49,7 @@ DAccount::List DAccountManagerDataBase::getAccountList() accountList.append(account); } } else { - qWarning() << "getAccountList error:" << query.lastError(); + qCWarning(ServiceLogger) << "getAccountList error:" << query.lastError(); } return accountList; } @@ -77,10 +78,10 @@ DAccount::Ptr DAccountManagerDataBase::getAccountByID(const QString &accountID) account->setDtCreate(QDateTime::fromString(query.value("dtCreate").toString(), Qt::ISODate)); return account; } else { - qWarning() << "getAccountByID error:" << query.lastError(); + qCWarning(ServiceLogger) << "getAccountByID error:" << query.lastError(); } } else { - qWarning() << "getAccountByID error:" << query.lastError(); + qCWarning(ServiceLogger) << "getAccountByID error:" << query.lastError(); } return nullptr; @@ -113,11 +114,11 @@ QString DAccountManagerDataBase::addAccountInfo(const DAccount::Ptr &accountInfo query.addBindValue(accountInfo->isExpandDisplay()); query.addBindValue(0); if (!query.exec()) { - qWarning() << "addAccountInfo error:" << query.lastError(); + qCWarning(ServiceLogger) << "addAccountInfo error:" << query.lastError(); accountInfo->setAccountID(""); } } else { - qWarning() << "addAccountInfo error:" << query.lastError(); + qCWarning(ServiceLogger) << "addAccountInfo error:" << query.lastError(); accountInfo->setAccountID(""); } @@ -147,7 +148,7 @@ bool DAccountManagerDataBase::updateAccountInfo(const DAccount::Ptr &accountInfo res = query.exec(); } if (!res) { - qWarning() << "updateAccountInfo error:" << query.lastError(); + qCWarning(ServiceLogger) << "updateAccountInfo error:" << query.lastError(); } return res; @@ -165,7 +166,7 @@ bool DAccountManagerDataBase::deleteAccountInfo(const QString &accountID) } if (!res) { - qWarning() << "deleteAccountInfo error:" << query.lastError(); + qCWarning(ServiceLogger) << "deleteAccountInfo error:" << query.lastError(); } return res; } @@ -191,13 +192,13 @@ void DAccountManagerDataBase::setCalendarGeneralSettings(const DCalendarGeneralS query.prepare("update calendargeneralsettings set vch_value = ? where vch_key = 'firstDayOfWeek' "); query.addBindValue(cgSet->firstDayOfWeek()); if (!query.exec()) { - qWarning() << "UPDATE calendargeneralsettings error," << query.lastError(); + qCWarning(ServiceLogger) << "UPDATE calendargeneralsettings error," << query.lastError(); } query.prepare("update calendargeneralsettings set vch_value = ? where vch_key = 'timeShowType' "); query.addBindValue(cgSet->timeShowType()); if (!query.exec()) { - qWarning() << "UPDATE calendargeneralsettings error," << query.lastError(); + qCWarning(ServiceLogger) << "UPDATE calendargeneralsettings error," << query.lastError(); } } @@ -214,7 +215,7 @@ void DAccountManagerDataBase::createDB() } //将权限修改为600(对文件的所有者可以读写,其他用户不可读不可写) if (!file.setPermissions(QFile::WriteOwner | QFile::ReadOwner)) { - qWarning() << "permissions cannot be modified,error:" << file.errorString(); + qCWarning(ServiceLogger) << "permissions cannot be modified,error:" << file.errorString(); } if (m_database.open()) { @@ -223,14 +224,14 @@ void DAccountManagerDataBase::createDB() //创建帐户管理表 res = query.exec(sql_create_accountManager); if (!res) { - qWarning() << "accountManager create failed.error:" << query.lastError(); + qCWarning(ServiceLogger) << "accountManager create failed.error:" << query.lastError(); } //日历通用设置 res = query.exec(sql_create_calendargeneralsettings); if (!res) { - qWarning() << "uploadTask create failed.error:" << query.lastError(); + qCWarning(ServiceLogger) << "uploadTask create failed.error:" << query.lastError(); } //创建calendargeneralsettings的触发器,数据有变动时,更新dt_update @@ -301,10 +302,10 @@ void DAccountManagerDataBase::initAccountManagerDB() query.finish(); } } else { - qWarning() << __FUNCTION__ << query.lastError(); + qCWarning(ServiceLogger) << __FUNCTION__ << query.lastError(); } } else { - qWarning() << __FUNCTION__ << query.lastError(); + qCWarning(ServiceLogger) << __FUNCTION__ << query.lastError(); } } @@ -316,7 +317,7 @@ void DAccountManagerDataBase::initAccountManagerDB() "('timeShowType', '0')")) { m_database.commit(); } else { - qWarning() << __FUNCTION__ << query.lastError(); + qCWarning(ServiceLogger) << __FUNCTION__ << query.lastError(); } } } diff --git a/calendar-service/src/dbmanager/ddatabasemanagement.cpp b/calendar-service/src/dbmanager/ddatabasemanagement.cpp index 479558e2c..5a76cae78 100644 --- a/calendar-service/src/dbmanager/ddatabasemanagement.cpp +++ b/calendar-service/src/dbmanager/ddatabasemanagement.cpp @@ -4,6 +4,7 @@ #include "ddatabasemanagement.h" +#include "commondef.h" #include "ddatabase.h" #include "vcalformat.h" #include "daccountdatabase.h" @@ -321,7 +322,7 @@ DSchedule::List DDataBaseManagement::queryOldJobData(QSqlDatabase &db, const boo if (m_typeMap.contains(type)) { schedule->setScheduleTypeID(m_typeMap[type]); } else { - qWarning() << " can not find type:" << type; + qCWarning(ServiceLogger) << " can not find type:" << type; } scheduleList.append(schedule); } diff --git a/calendar-service/src/dbmanager/dhuanglidatabase.cpp b/calendar-service/src/dbmanager/dhuanglidatabase.cpp index 67075d1e7..f0ea3226e 100644 --- a/calendar-service/src/dbmanager/dhuanglidatabase.cpp +++ b/calendar-service/src/dbmanager/dhuanglidatabase.cpp @@ -3,8 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "dhuanglidatabase.h" -#include "units.h" - +#include "commondef.h" #include #include #include @@ -43,7 +42,7 @@ QString DHuangLiDataBase::queryFestivalList(quint32 year, quint8 month) if (!doctmp.isNull()) { listarr = doctmp.array(); } else { - qDebug() << __FUNCTION__ << error.errorString(); + qCDebug(ServiceLogger) << __FUNCTION__ << error.errorString(); } obj.insert("list", listarr); arr.append(obj); @@ -51,7 +50,7 @@ QString DHuangLiDataBase::queryFestivalList(quint32 year, quint8 month) doc.setArray(arr); strjson = QString::fromUtf8(doc.toJson(QJsonDocument::Compact)); } else { - qWarning() << Q_FUNC_INFO << query.lastError(); + qCWarning(ServiceLogger) << Q_FUNC_INFO << query.lastError(); } if (query.isActive()) { query.finish(); diff --git a/calendar-service/src/dbus/dbusnotify.h b/calendar-service/src/dbus/dbusnotify.h index 0034cf921..c8e509a49 100644 --- a/calendar-service/src/dbus/dbusnotify.h +++ b/calendar-service/src/dbus/dbusnotify.h @@ -4,6 +4,7 @@ #ifndef DBUSNOTIFY_H #define DBUSNOTIFY_H +#include "commondef.h" #include class DBusNotify : public QDBusAbstractInterface @@ -17,13 +18,13 @@ class DBusNotify : public QDBusAbstractInterface int notifyid = -1; if (QDBusMessage::ReplyMessage == reply.type()) { - qDebug() << reply.type() << reply.errorName() << reply.errorMessage(); + qCDebug(ServiceLogger) << reply.type() << reply.errorName() << reply.errorMessage(); QDBusReply id = reply; if (id.isValid()) { notifyid = id.value(); } } else { - qDebug() << reply.type() << reply.errorName() << reply.errorMessage(); + qCDebug(ServiceLogger) << reply.type() << reply.errorName() << reply.errorMessage(); } return notifyid; } diff --git a/calendar-service/src/dbus/dunioniddbus.cpp b/calendar-service/src/dbus/dunioniddbus.cpp index cee8666b2..833f8cdda 100644 --- a/calendar-service/src/dbus/dunioniddbus.cpp +++ b/calendar-service/src/dbus/dunioniddbus.cpp @@ -3,13 +3,14 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "dunioniddbus.h" +#include "commondef.h" DUnionIDDbus::DUnionIDDbus(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) { if (!this->isValid()) { - qWarning() << "Error connecting remote object, service:" << this->service() << ",path:" << this->path() << ",interface" << this->interface(); - qWarning() << this->lastError(); + qCWarning(ServiceLogger) << "Error connecting remote object, service:" << this->service() << ",path:" << this->path() << ",interface" << this->interface(); + qCWarning(ServiceLogger) << this->lastError(); } } diff --git a/calendar-service/src/dbusservice/dservicemanager.cpp b/calendar-service/src/dbusservice/dservicemanager.cpp index 99742714e..c253315a4 100644 --- a/calendar-service/src/dbusservice/dservicemanager.cpp +++ b/calendar-service/src/dbusservice/dservicemanager.cpp @@ -7,6 +7,7 @@ #include "dhuangliservice.h" #include "daccountmanagerservice.h" #include "units.h" +#include "commondef.h" #include "dbuscloudsync.h" #include @@ -19,7 +20,7 @@ DServiceManager::DServiceManager(QObject *parent) //注册服务 QDBusConnection sessionBus = QDBusConnection::sessionBus(); if (!sessionBus.registerService(serviceBaseName)) { - qCritical() << "registerService failed:" << sessionBus.lastError(); + qCritical(ServiceLogger) << "registerService failed:" << sessionBus.lastError(); exit(0x0001); } @@ -27,21 +28,21 @@ DServiceManager::DServiceManager(QObject *parent) //创建黄历服务 DServiceBase *huangliService = new class DHuangliService(this); if (!sessionBus.registerObject(huangliService->getPath(), huangliService->getInterface(), huangliService, options)) { - qCritical() << "registerObject huangliService failed:" << sessionBus.lastError(); + qCritical(ServiceLogger) << "registerObject huangliService failed:" << sessionBus.lastError(); exit(0x0002); } //创建帐户管理服务 m_accountManagerService = new class DAccountManagerService(this); if (!sessionBus.registerObject(m_accountManagerService->getPath(), m_accountManagerService->getInterface(), m_accountManagerService, options)) { - qCritical() << "registerObject accountManagerService failed:" << sessionBus.lastError(); + qCritical(ServiceLogger) << "registerObject accountManagerService failed:" << sessionBus.lastError(); exit(0x0003); } //创建云同步回调服务 DServiceBase *cloudsyncService = new class Dbuscloudsync(this); if (!sessionBus.registerObject(cloudsyncService->getPath(), cloudsyncService->getInterface(), cloudsyncService, options)) { - qCritical() << "registerObject cloudsyncService failed:" << sessionBus.lastError(); + qCritical(ServiceLogger) << "registerObject cloudsyncService failed:" << sessionBus.lastError(); exit(0x0004); } } diff --git a/calendar-service/src/lunarandfestival/lunarcalendar.cpp b/calendar-service/src/lunarandfestival/lunarcalendar.cpp index bd20f5e79..9ae67de18 100644 --- a/calendar-service/src/lunarandfestival/lunarcalendar.cpp +++ b/calendar-service/src/lunarandfestival/lunarcalendar.cpp @@ -139,7 +139,7 @@ void LunarCalendar::calcLeapMonth() } if (i < 14) { // 找到闰月 - //qDebug()< @@ -158,7 +159,7 @@ QList GetFestivalsInRange(const QDateTime &start, const QDateTime festivaldays.append(stdayfestival); } } else { - qDebug() << __FUNCTION__ << "start day later than end day"; + qCDebug(ServiceLogger) << __FUNCTION__ << "start day later than end day"; } return festivaldays; diff --git a/calendar-service/src/main.cpp b/calendar-service/src/main.cpp index d40e91fbb..3646be051 100644 --- a/calendar-service/src/main.cpp +++ b/calendar-service/src/main.cpp @@ -4,7 +4,7 @@ #include "dservicemanager.h" #include "ddatabasemanagement.h" - +#include "commondef.h" #include #include @@ -51,10 +51,11 @@ int main(int argc, char *argv[]) Dtk::Core::DLogManager::registerConsoleAppender(); Dtk::Core::DLogManager::registerFileAppender(); + Dtk::Core::DLogManager::registerJournalAppender(); //加载翻译 if (!loadTranslator(&a)) { - qDebug() << "loadtranslator failed"; + qCDebug(ServiceLogger) << "loadtranslator failed"; } DDataBaseManagement dbManagement; @@ -68,6 +69,6 @@ int main(int argc, char *argv[]) serviceManager.updateRemindJob(); }); } - + qCDebug(ServiceLogger) << "dde-calendar-service start"; return a.exec(); } diff --git a/calendar-service/src/pinyin/pinyinsearch.cpp b/calendar-service/src/pinyin/pinyinsearch.cpp index 9f12c4aad..b054ad751 100644 --- a/calendar-service/src/pinyin/pinyinsearch.cpp +++ b/calendar-service/src/pinyin/pinyinsearch.cpp @@ -4,7 +4,7 @@ #include "pinyinsearch.h" #include "pinyindict.h" - +#include "commondef.h" #include #include #include @@ -80,7 +80,7 @@ void pinyinsearch::initDict() QFile file(kDictFile); if (!file.open(QIODevice::ReadOnly)) { - qWarning() << "open dictFile error :" << file.error(); + qCWarning(ServiceLogger) << "open dictFile error :" << file.error(); return; } diff --git a/calendar-service/src/synchronization/dataencrypt.cpp b/calendar-service/src/synchronization/dataencrypt.cpp index 8127b3334..c7909a6a5 100644 --- a/calendar-service/src/synchronization/dataencrypt.cpp +++ b/calendar-service/src/synchronization/dataencrypt.cpp @@ -14,13 +14,13 @@ // if (AES_set_encrypt_key(reinterpret_cast(key.data()), key.size() * 8, // &aesKey) // != 0) { -// qWarning() << "Init failed"; +// qCWarning(ServiceLogger) << "Init failed"; // return result; // } // result = aesCbcEncrypt(data, aesKey, initialVector, AES_ENCRYPT); // if (result.isEmpty()) -// qWarning() << "Encrypt failed"; +// qCWarning(ServiceLogger) << "Encrypt failed"; // return result; //} @@ -33,13 +33,13 @@ // if (AES_set_decrypt_key(reinterpret_cast(key.data()), key.size() * 8, // &aesKey) // != 0) { -// qWarning() << "Init failed"; +// qCWarning(ServiceLogger) << "Init failed"; // return result; // } // result = aesCbcEncrypt(data, aesKey, initialVector, AES_DECRYPT); // if (result.isEmpty()) -// qWarning() << "Decrypt failed"; +// qCWarning(ServiceLogger) << "Decrypt failed"; // return result; //} @@ -49,7 +49,7 @@ //{ // QByteArray result; // if (initialVector.size() != AES_BLOCK_SIZE) { -// qWarning() << "The length of init vector must be" << AES_BLOCK_SIZE; +// qCWarning(ServiceLogger) << "The length of init vector must be" << AES_BLOCK_SIZE; // return result; // } @@ -75,13 +75,13 @@ // if (AES_set_encrypt_key(reinterpret_cast(key.data()), key.size() * 8, // &aesKey) // != 0) { -// qWarning() << "Init failed"; +// qCWarning(ServiceLogger) << "Init failed"; // return result; // } // result = aesCfb128Encrypt(data, aesKey, initialVector, AES_ENCRYPT); // if (result.isEmpty()) -// qWarning() << "Encrypt failed"; +// qCWarning(ServiceLogger) << "Encrypt failed"; // return result; //} @@ -99,13 +99,13 @@ // if (AES_set_encrypt_key(reinterpret_cast(key.data()), key.size() * 8, // &aesKey) // != 0) { -// qWarning() << "Init failed"; +// qCWarning(ServiceLogger) << "Init failed"; // return result; // } // result = aesCfb128Encrypt(data, aesKey, initialVector, AES_DECRYPT); // if (result.isEmpty()) -// qWarning() << "Decrypt failed"; +// qCWarning(ServiceLogger) << "Decrypt failed"; // return result; //} @@ -116,7 +116,7 @@ //{ // QByteArray result; // if (initialVector.size() != AES_BLOCK_SIZE) { -// qWarning() << "The length of init vector must be" << AES_BLOCK_SIZE; +// qCWarning(ServiceLogger) << "The length of init vector must be" << AES_BLOCK_SIZE; // return result; // } diff --git a/calendar-service/src/synchronization/dbuscloudsync.cpp b/calendar-service/src/synchronization/dbuscloudsync.cpp index 08c214767..eeb24d272 100644 --- a/calendar-service/src/synchronization/dbuscloudsync.cpp +++ b/calendar-service/src/synchronization/dbuscloudsync.cpp @@ -6,6 +6,7 @@ #include #include #include "units.h" +#include "commondef.h" Dbuscloudsync::Dbuscloudsync(QObject *parent) : DServiceBase(serviceBasePath + "/CloudSync", serviceBaseName + ".CloudSync", parent) @@ -21,6 +22,6 @@ void Dbuscloudsync::MsgCallBack(const QByteArray &msg) //TODO:解析获取到的数据,依据需要做后续操作 - qWarning() << "Get " << " error."; + qCWarning(CommonLogger) << "Get " << " error."; } diff --git a/calendar-service/src/synchronization/syncfilemanage.cpp b/calendar-service/src/synchronization/syncfilemanage.cpp index 2a7d8b0bf..26a0befee 100644 --- a/calendar-service/src/synchronization/syncfilemanage.cpp +++ b/calendar-service/src/synchronization/syncfilemanage.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "syncfilemanage.h" +#include "commondef.h" #include @@ -39,7 +40,7 @@ bool SyncFileManage::SyncDataDownload(const QString &uid, QString &filepath, int //文件下载路径不正确 //将文件移动到正确路径 if (!QFile::rename(result.data, syncDB)) { - qWarning() << "down path error!"; + qCWarning(ServiceLogger) << "down path error!"; errorcode = -1; return false; } @@ -66,7 +67,7 @@ bool SyncFileManage::SyncDbCreate(const QString &DBpath) if (!file.exists()) { bool bRet = file.open(QIODevice::ReadWrite | QIODevice::Text | QIODevice::Append); if (!bRet) { - qWarning() << "file creat failed"; + qCWarning(ServiceLogger) << "file creat failed"; return false; } file.close(); @@ -77,10 +78,10 @@ bool SyncFileManage::SyncDbCreate(const QString &DBpath) m_db.setPassword(syncDBpassword); m_db.setDatabaseName(DBpath); if (!m_db.open()) { - qWarning() << "db open failed"; + qCWarning(ServiceLogger) << "db open failed"; return false; } - qInfo() << "db open successed"; + qCInfo(ServiceLogger) << "db open successed"; m_db.close(); return true; } @@ -88,7 +89,7 @@ bool SyncFileManage::SyncDbCreate(const QString &DBpath) bool SyncFileManage::SyncDbDelete(const QString &DBpath) { if (DBpath.isEmpty()) { - qWarning() << "DBpath isEmpty"; + qCWarning(ServiceLogger) << "DBpath isEmpty"; return false; } QFileInfo fileinfo(DBpath); @@ -109,7 +110,7 @@ bool SyncFileManage::SyncDataUpload(const QString &filepath, int &errorcode) result = m_syncoperation->optUpload(filepath); errorcode = result.error_code; if (result.error_code != SYNC_No_Error) { - qWarning() << "upload failed"; + qCWarning(ServiceLogger) << "upload failed"; return false; } return true; @@ -118,7 +119,7 @@ bool SyncFileManage::SyncDataUpload(const QString &filepath, int &errorcode) bool SyncFileManage::syncDataDelete(const QString &filepath) { if (!SyncDbDelete(filepath)) { - qWarning() << "delete file error:" << filepath; + qCWarning(ServiceLogger) << "delete file error:" << filepath; return false; } return true; @@ -133,7 +134,7 @@ DAccount::Ptr SyncFileManage::getuserInfo() } if (!m_syncoperation->optUserData(userInfoMap)) { - qInfo() << "can't get userinfo"; + qCInfo(ServiceLogger) << "can't get userinfo"; return nullptr; } diff --git a/calendar-service/src/synchronization/syncoperation.cpp b/calendar-service/src/synchronization/syncoperation.cpp index 336a21617..96d8d29cc 100644 --- a/calendar-service/src/synchronization/syncoperation.cpp +++ b/calendar-service/src/synchronization/syncoperation.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "syncoperation.h" +#include "commondef.h" Syncoperation::Syncoperation(QObject *parent) @@ -15,12 +16,12 @@ Syncoperation::Syncoperation(QObject *parent) "org.freedesktop.DBus.Properties", QLatin1String("PropertiesChanged"), this, SLOT(onPropertiesChanged(QString, QVariantMap, QStringList)))) { - qWarning() << "the PropertiesChanged was fail!"; + qCWarning(ServiceLogger) << "the PropertiesChanged was fail!"; } if (!QDBusConnection::sessionBus().connect(m_syncInter->service(), m_syncInter->path(), m_syncInter->interface(), "", this, SLOT(slotDbusCall(QDBusMessage)))) { - qWarning() << "the connection was fail!" << "path: " << m_syncInter->path() << "interface: " << m_syncInter->interface(); + qCWarning(ServiceLogger) << "the connection was fail!" << "path: " << m_syncInter->path() << "interface: " << m_syncInter->interface(); }; } @@ -47,7 +48,7 @@ SyncoptResult Syncoperation::optUpload(const QString &key) QDBusPendingReply reply = m_syncInter->Upload(key); reply.waitForFinished(); if (reply.error().message().isEmpty()) { - qInfo() << "Upload success!"; + qCInfo(ServiceLogger) << "Upload success!"; //解析上传成功数据的元信息ID值 ,这个ID值暂时没用,不解析出来 // QJsonObject json; // json = QJsonDocument::fromJson(reply).object(); @@ -55,14 +56,14 @@ SyncoptResult Syncoperation::optUpload(const QString &key) // QJsonObject subJsonObject = json.value(QString("data")).toObject(); // if (subJsonObject.contains(QString("id"))) { // result.data = subJsonObject.value(QString("id")).toString(); -// qInfo() << result.data; +// qCInfo(ServiceLogger) << result.data; // } // } result.data = reply.value(); result.ret = true; result.error_code = SYNC_No_Error; } else { - qWarning() << "Upload failed:" << reply.error().message(); + qCWarning(ServiceLogger) << "Upload failed:" << reply.error().message(); result.ret = false; QJsonDocument jsonDocument = QJsonDocument::fromJson(reply.error().message().toLocal8Bit().data()); QJsonObject obj = jsonDocument.object(); @@ -80,18 +81,18 @@ SyncoptResult Syncoperation::optDownload(const QString &key, const QString &path QDBusPendingReply reply = m_syncInter->Download(key, path); reply.waitForFinished(); if (reply.error().message().isEmpty()) { - qInfo() << "Download success!"; + qCInfo(ServiceLogger) << "Download success!"; result.data = reply.value(); result.ret = true; result.error_code = SYNC_No_Error; } else { - qWarning() << "Download failed:" << reply.error().message(); + qCWarning(ServiceLogger) << "Download failed:" << reply.error().message(); result.ret = false; QJsonDocument jsonDocument = QJsonDocument::fromJson(reply.error().message().toLocal8Bit().data()); QJsonObject obj = jsonDocument.object(); if (obj.contains(QString("code"))) { result.error_code = obj.value(QString("code")).toInt(); - qWarning() << result.error_code; + qCWarning(ServiceLogger) << result.error_code; } } @@ -104,18 +105,18 @@ SyncoptResult Syncoperation::optDelete(const QString &key) QDBusPendingReply reply = m_syncInter->Delete(key); reply.waitForFinished(); if (reply.error().message().isEmpty()) { - qInfo() << "Delete success!"; + qCInfo(ServiceLogger) << "Delete success!"; result.data = reply.value(); result.ret = true; result.error_code = SYNC_No_Error; } else { - qWarning() << "Delete failed:" << reply.error().message(); + qCWarning(ServiceLogger) << "Delete failed:" << reply.error().message(); result.ret = false; QJsonDocument jsonDocument = QJsonDocument::fromJson(reply.error().message().toLocal8Bit().data()); QJsonObject obj = jsonDocument.object(); if (obj.contains(QString("code"))) { result.error_code = obj.value(QString("code")).toInt(); - qWarning() << result.error_code; + qCWarning(ServiceLogger) << result.error_code; } } @@ -128,19 +129,19 @@ SyncoptResult Syncoperation::optMetadata(const QString &key) QDBusPendingReply reply = m_syncInter->Metadata(key); reply.waitForFinished(); if (reply.error().message().isEmpty()) { - qInfo() << "Metadata success!"; + qCInfo(ServiceLogger) << "Metadata success!"; //元数据获取接口,暂时好像用不到 result.data = reply.value(); result.ret = true; result.error_code = SYNC_No_Error; } else { - qWarning() << "Metadata failed:" << reply.error().message(); + qCWarning(ServiceLogger) << "Metadata failed:" << reply.error().message(); result.ret = false; QJsonDocument jsonDocument = QJsonDocument::fromJson(reply.error().message().toLocal8Bit().data()); QJsonObject obj = jsonDocument.object(); if (obj.contains(QString("code"))) { result.error_code = obj.value(QString("code")).toInt(); - qWarning() << result.error_code; + qCWarning(ServiceLogger) << result.error_code; } } @@ -162,7 +163,7 @@ bool Syncoperation::optUserData(QVariantMap &userInfoMap) argument >> userInfoMap; return true; } else { - qWarning() << "Download failed:"; + qCWarning(ServiceLogger) << "Download failed:"; return false; } } @@ -219,14 +220,14 @@ SyncoptResult Syncoperation::optGetCalendarSwitcher() result.switch_state = reply.value(); result.ret = true; } else { - qDebug() << "get calendar switcher failed"; + qCDebug(ServiceLogger) << "get calendar switcher failed"; result.ret = false; } } else { result.ret = false; } } else { - qDebug() << "get main switcher failed"; + qCDebug(ServiceLogger) << "get main switcher failed"; result.ret = false; } @@ -258,7 +259,7 @@ void Syncoperation::slotDbusCall(const QDBusMessage &msg) if (loginStatus.size() > 0) { emit signalLoginStatusChange(loginStatus.first()); } else { - qWarning() << "get loginStatus error"; + qCWarning(ServiceLogger) << "get loginStatus error"; } } } diff --git a/calendar-service/src/unionIDDav/dsyncdatafactory.cpp b/calendar-service/src/unionIDDav/dsyncdatafactory.cpp index 985b1cac2..b0600027d 100644 --- a/calendar-service/src/unionIDDav/dsyncdatafactory.cpp +++ b/calendar-service/src/unionIDDav/dsyncdatafactory.cpp @@ -5,6 +5,7 @@ #include "dsyncdatafactory.h" #include "dunioniddav.h" +#include "commondef.h" #include @@ -18,7 +19,7 @@ DDataSyncBase *DSyncDataFactory::createDataSync(const DAccount::Ptr &account) switch (account->accountType()) { case DAccount::Account_UnionID: syncBase = new DUnionIDDav(); - qInfo() << "创建同步任务"; + qCInfo(ServiceLogger) << "创建同步任务"; break; default: syncBase = nullptr; diff --git a/calendar-service/src/unionIDDav/dunioniddav.cpp b/calendar-service/src/unionIDDav/dunioniddav.cpp index 9a4bed161..0e1ed2b8e 100644 --- a/calendar-service/src/unionIDDav/dunioniddav.cpp +++ b/calendar-service/src/unionIDDav/dunioniddav.cpp @@ -7,6 +7,7 @@ #include "dcalendargeneralsettings.h" #include "syncfilemanage.h" #include "units.h" +#include "commondef.h" #include "ddatabase.h" #include "dunioniddav_p.h" @@ -229,7 +230,7 @@ void DUIDSynDataWorker::startUpdate() //删除临时文件 mSync.deleteTmpData(fileManger); - qInfo() << "同步完成"; + qCInfo(ServiceLogger) << "同步完成"; if (errCode == 0) { //发送数据更新消息 emit signalUpdate(updateType); @@ -253,7 +254,7 @@ DUnionIDDav::~DUnionIDDav() void DUnionIDDav::syncData(QString accountId, QString accountName, int accountState, DDataSyncBase::SyncTypes syncType) { - qInfo() << "DUnionIDDav 同步数据"; + qCInfo(ServiceLogger) << "DUnionIDDav 同步数据"; d->syncData(accountId, accountName, accountState, syncType); } @@ -273,7 +274,7 @@ int SyncStack::downloadUidData(bool &isInitSyncData, SyncFileManage &fileManger) if (!db_sync.open()) { return -1; } - qInfo() << "初始化表结构"; + qCInfo(ServiceLogger) << "初始化表结构"; SqliteQuery query(dbname_sync_thread); @@ -298,19 +299,19 @@ int SyncStack::downloadUidData(bool &isInitSyncData, SyncFileManage &fileManger) query.exec("select count(0) from scheduleType"); if (query.next() && query.value(0).toInt() == 0) { - qInfo() << "没有数据则设置:默认日程类型、颜色、默认通用设置"; + qCInfo(ServiceLogger) << "没有数据则设置:默认日程类型、颜色、默认通用设置"; SyncAccount accountDb(dbname_sync_thread, accountId); - qInfo() << "默认日程类型"; + qCInfo(ServiceLogger) << "默认日程类型"; if (!accountDb.defaultScheduleType()) return -1; - qInfo() << "默认颜色"; + qCInfo(ServiceLogger) << "默认颜色"; if (!accountDb.defaultTypeColor()) return -1; if (accountState & DAccount::Account_Setting) { - qInfo() << "默认通用设置"; + qCInfo(ServiceLogger) << "默认通用设置"; if(needUpdateSettingValue()) { if (!syncIntoTable("calendargeneralsettings", dbname_manager_thread, dbname_sync_thread)) return -1; @@ -325,7 +326,7 @@ int SyncStack::downloadUidData(bool &isInitSyncData, SyncFileManage &fileManger) int SyncStack::loadToTmp() { - qInfo() << "将本地A的uploadTask同步到刚刚下载的B里"; + qCInfo(ServiceLogger) << "将本地A的uploadTask同步到刚刚下载的B里"; if(accountState & DAccount::Account_Calendar) { SqliteQuery query(dbname_account_thread); query.exec("select taskID,uploadType,uploadObject,objectID from uploadTask"); @@ -340,40 +341,40 @@ int SyncStack::loadToTmp() case DUploadTaskData::Create: case DUploadTaskData::Modify: if (!replaceIntoRecord(table_name, selectRecord(table_name, key_name, key_value, dbname_account_thread), dbname_sync_thread)){ - qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + qCWarning(ServiceLogger)<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; return -1; } break; case DUploadTaskData::Delete: if (!deleteTableLine(table_name, key_name, key_value, dbname_sync_thread)){ - qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + qCWarning(ServiceLogger)<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; return -1; } break; } } - qInfo() << "清空uploadTask"; + qCInfo(ServiceLogger) << "清空uploadTask"; if (!deleteTable("uploadTask", dbname_account_thread)){ - qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + qCWarning(ServiceLogger)<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; return -1; } } if (accountState & DAccount::Account_Setting) { - qInfo() << "同步通用设置"; + qCInfo(ServiceLogger) << "同步通用设置"; if(needUpdateSettingValue()) { QDateTime managerDate = selectValue("vch_value", "calendargeneralsettings", "vch_key", "dt_update", dbname_manager_thread).toDateTime(); QDateTime syncDate = selectValue("vch_value", "calendargeneralsettings", "vch_key", "dt_update", dbname_sync_thread).toDateTime(); if (managerDate > syncDate) if (!syncIntoTable("calendargeneralsettings", dbname_manager_thread, dbname_sync_thread)){ - qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + qCWarning(ServiceLogger)<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; return -1; } if (syncDate > managerDate) if (!syncIntoTable("calendargeneralsettings", dbname_sync_thread, dbname_manager_thread)){ - qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + qCWarning(ServiceLogger)<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; return -1; } } @@ -402,27 +403,27 @@ bool SyncStack::needUpdateSettingValue() { int SyncStack::tmpToLoad(DDataSyncBase::UpdateTypes &updateType) { if (accountState & DAccount::Account_Calendar) { - qInfo() << "更新schedules、schedules、typeColor"; + qCInfo(ServiceLogger) << "更新schedules、schedules、typeColor"; if (!syncIntoTable("schedules", dbname_sync_thread, dbname_account_thread)){ - qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + qCWarning(ServiceLogger)<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; return -1; } if (!syncIntoTable("scheduleType", dbname_sync_thread, dbname_account_thread)){ - qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + qCWarning(ServiceLogger)<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; return -1; } if (!syncIntoTable("typeColor", dbname_sync_thread, dbname_account_thread)){ - qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + qCWarning(ServiceLogger)<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; return -1; } updateType = DUnionIDDav::Update_Schedule | DUnionIDDav::Update_ScheduleType; } if (accountState & DAccount::Account_Setting) { - qInfo() << "更新通用设置"; + qCInfo(ServiceLogger) << "更新通用设置"; if(needUpdateSettingValue()) { if (!syncIntoTable("calendargeneralsettings", dbname_sync_thread, dbname_manager_thread)){ - qWarning()<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; + qCWarning(ServiceLogger)<<"faild:" <<__FUNCTION__ <<" : "<<__LINE__; return -1; } } @@ -466,7 +467,7 @@ bool SyncStack::syncIntoTable(const QString &table_name, const QString &connecti SqliteQuery source(QSqlDatabase::database(connection_name_source)); SqliteQuery target(QSqlDatabase::database(connection_name_target)); if (!target.exec(" delete from " + table_name)){ - qWarning() << target.lastError() <<"table_name:"<getLocalAccountItem(); if (account.isNull()) { - qWarning() << "account is null"; + qCWarning(CommonLogger) << "account is null"; return QString(); } return account->createSchedule(schedule); @@ -27,7 +28,7 @@ DSchedule::Ptr DScheduleDataManager::queryScheduleByScheduleID(const QString &sc DSchedule::Ptr schedule; AccountItem::Ptr account = gAccounManager->getLocalAccountItem(); if (account.isNull()) { - qWarning() << "account is null"; + qCWarning(CommonLogger) << "account is null"; return nullptr; } return account->getScheduleByID(scheduleID); @@ -37,7 +38,7 @@ bool DScheduleDataManager::deleteScheduleByScheduleID(const QString &scheduleID) { AccountItem::Ptr account = gAccounManager->getLocalAccountItem(); if (account.isNull()) { - qWarning() << "account is null"; + qCWarning(CommonLogger) << "account is null"; return false; } account->deleteScheduleByID(scheduleID); @@ -48,7 +49,7 @@ bool DScheduleDataManager::updateSchedule(const DSchedule::Ptr &schedule) { AccountItem::Ptr account = gAccounManager->getLocalAccountItem(); if (account.isNull()) { - qWarning() << "account is null"; + qCWarning(CommonLogger) << "account is null"; return false; } account->updateSchedule(schedule); diff --git a/schedule-plugin/src/dbus/dbusaccountmanagerrequest.cpp b/schedule-plugin/src/dbus/dbusaccountmanagerrequest.cpp index 8c751d595..8e16c0cf4 100644 --- a/schedule-plugin/src/dbus/dbusaccountmanagerrequest.cpp +++ b/schedule-plugin/src/dbus/dbusaccountmanagerrequest.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "dbusaccountmanagerrequest.h" +#include "commondef.h" #include DbusAccountManagerRequest::DbusAccountManagerRequest(QObject *parent) @@ -91,7 +92,7 @@ void DbusAccountManagerRequest::slotCallFinished(CDBusPendingCallWatcher *call) //错误处理 if (call->isError()) { //打印错误信息 - qWarning() << call->reply().member() << call->error().message(); + qCWarning(CommonLogger) << call->reply().member() << call->error().message(); ret = 1; } else if (call->getmember() == "getAccountList") { //"getAccountList"方法回调事件 @@ -103,11 +104,11 @@ void DbusAccountManagerRequest::slotCallFinished(CDBusPendingCallWatcher *call) if (DAccount::fromJsonListString(accountList, str)) { emit signalGetAccountListFinish(accountList); } else { - qWarning()<< "AccountList Parsing failed!"; + qCWarning(CommonLogger)<< "AccountList Parsing failed!"; ret = 2; } } else if (call->getmember() == "getCalendarGeneralSettings") { - qInfo() << "getCalendarGeneralSettings"; + qCInfo(CommonLogger) << "getCalendarGeneralSettings"; QDBusPendingReply reply = *call; QString str = reply.argumentAt<0>(); DCalendarGeneralSettings::Ptr ptr; @@ -115,7 +116,7 @@ void DbusAccountManagerRequest::slotCallFinished(CDBusPendingCallWatcher *call) if (DCalendarGeneralSettings::fromJsonString(ptr, str)) { emit signalGetGeneralSettingsFinish(ptr); } else { - qWarning() <<"AccountList Parsing failed!"; + qCWarning(CommonLogger) <<"AccountList Parsing failed!"; ret = 2; } } else if (call->getmember() == "setCalendarGeneralSettings") { diff --git a/schedule-plugin/src/dbus/dbusaccountrequest.cpp b/schedule-plugin/src/dbus/dbusaccountrequest.cpp index ed7f60da9..099acba41 100644 --- a/schedule-plugin/src/dbus/dbusaccountrequest.cpp +++ b/schedule-plugin/src/dbus/dbusaccountrequest.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "dbusaccountrequest.h" +#include "commondef.h" #include @@ -39,7 +40,7 @@ DScheduleType::List DbusAccountRequest::getScheduleTypeList() pCall.waitForFinished(); QDBusMessage reply = pCall.reply(); if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "getScheduleTypeList error ," << reply; + qCWarning(CommonLogger) << "getScheduleTypeList error ," << reply; return typeList; } QDBusReply scheduleReply = reply; @@ -118,7 +119,7 @@ QString DbusAccountRequest::createSchedule(const DSchedule::Ptr &scheduleInfo) pCall.waitForFinished(); QDBusMessage reply = pCall.reply(); if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "getScheduleTypeByID error ," << reply; + qCWarning(CommonLogger) << "getScheduleTypeByID error ," << reply; return nullptr; } QDBusReply scheduleReply = reply; @@ -145,7 +146,7 @@ DSchedule::Ptr DbusAccountRequest::getScheduleByID(const QString &scheduleID) pCall.waitForFinished(); QDBusMessage reply = pCall.reply(); if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "getScheduleTypeByID error ," << reply; + qCWarning(CommonLogger) << "getScheduleTypeByID error ," << reply; return nullptr; } QDBusReply scheduleReply = reply; @@ -193,7 +194,7 @@ DSchedule::Map DbusAccountRequest::querySchedulesWithParameter(const DScheduleQu pCall.waitForFinished(); QDBusMessage reply = pCall.reply(); if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "getSysColors error ," << reply; + qCWarning(CommonLogger) << "getSysColors error ," << reply; return scheduleMap; } QDBusReply scheduleReply = reply; @@ -209,7 +210,7 @@ DTypeColor::List DbusAccountRequest::getSysColors() pCall.waitForFinished(); QDBusMessage reply = pCall.reply(); if (reply.type() != QDBusMessage::ReplyMessage) { - qWarning() << "getSysColors error ," << reply; + qCWarning(CommonLogger) << "getSysColors error ," << reply; return colorList; } QDBusReply scheduleReply = reply; @@ -224,7 +225,7 @@ void DbusAccountRequest::slotCallFinished(CDBusPendingCallWatcher *call) QString msg = ""; if (call->isError()) { - qWarning() << call->reply().member() << call->error().message(); + qCWarning(CommonLogger) << call->reply().member() << call->error().message(); ret = 1; } else { QDBusPendingReply reply = *call; @@ -235,7 +236,7 @@ void DbusAccountRequest::slotCallFinished(CDBusPendingCallWatcher *call) if (DAccount::fromJsonString(ptr, str.toString())) { emit signalGetAccountInfoFinish(ptr); } else { - qWarning() << "AccountInfo Parsing failed!"; + qCWarning(CommonLogger) << "AccountInfo Parsing failed!"; ret = 2; } } else if (call->getmember() == "getScheduleTypeList") { @@ -243,7 +244,7 @@ void DbusAccountRequest::slotCallFinished(CDBusPendingCallWatcher *call) if (DScheduleType::fromJsonListString(stList, str.toString())) { emit signalGetScheduleTypeListFinish(stList); } else { - qWarning() << "ScheduleTypeList Parsing failed!"; + qCWarning(CommonLogger) << "ScheduleTypeList Parsing failed!"; ret = 2; } } else if (call->getmember() == "querySchedulesWithParameter") { diff --git a/schedule-plugin/src/dbus/dbushuanglirequest.cpp b/schedule-plugin/src/dbus/dbushuanglirequest.cpp index 2e3f37436..861052cc2 100644 --- a/schedule-plugin/src/dbus/dbushuanglirequest.cpp +++ b/schedule-plugin/src/dbus/dbushuanglirequest.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "dbushuanglirequest.h" +#include "commondef.h" #include DbusHuangLiRequest::DbusHuangLiRequest(QObject *parent) @@ -72,7 +73,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(CommonLogger) << call->reply().member() << call->error().message(); return; } diff --git a/schedule-plugin/src/dbus/dbusrequestbase.cpp b/schedule-plugin/src/dbus/dbusrequestbase.cpp index a2847e267..de4949577 100644 --- a/schedule-plugin/src/dbus/dbusrequestbase.cpp +++ b/schedule-plugin/src/dbus/dbusrequestbase.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "dbusrequestbase.h" +#include "commondef.h" #include DbusRequestBase::DbusRequestBase(const QString &path, const QString &interface, const QDBusConnection &connection, QObject *parent) @@ -10,7 +11,7 @@ DbusRequestBase::DbusRequestBase(const QString &path, const QString &interface, { //关联后端dbus触发信号 if (!QDBusConnection::sessionBus().connect(this->service(), this->path(), this->interface(), "", this, SLOT(slotDbusCall(QDBusMessage)))) { - qWarning() << "the connection was fail!" + qCWarning(CommonLogger) << "the connection was fail!" << "path: " << this->path() << "interface: " << this->interface(); }; } diff --git a/schedule-plugin/src/state/selectandquerystate.cpp b/schedule-plugin/src/state/selectandquerystate.cpp index 053c482ef..0efaa321b 100644 --- a/schedule-plugin/src/state/selectandquerystate.cpp +++ b/schedule-plugin/src/state/selectandquerystate.cpp @@ -4,8 +4,10 @@ #include "selectandquerystate.h" #include "../globaldef.h" +#include "commondef.h" #include "../task/schedulebasetask.h" #include "../data/changejsondata.h" +#include SelectAndQueryState::SelectAndQueryState(scheduleBaseTask *task) : scheduleState(task) @@ -90,7 +92,7 @@ Reply SelectAndQueryState::normalEvent(const JsonData *jsonData) } return m_Task->getReplyBySelectSchedule(m_localData->SelectInfo()); } else { - qDebug() << "offset <=0"; + qCWarning(CommonLogger) << "offset <=0"; Reply reply; REPLY_ONLY_TTS(reply, G_ERR_TTS, G_ERR_TTS, false); return reply; diff --git a/schedule-plugin/src/task/createscheduletask.cpp b/schedule-plugin/src/task/createscheduletask.cpp index 5a93ebaa0..5319fcf51 100644 --- a/schedule-plugin/src/task/createscheduletask.cpp +++ b/schedule-plugin/src/task/createscheduletask.cpp @@ -5,6 +5,7 @@ #include "createscheduletask.h" #include "../globaldef.h" +#include "commondef.h" #include "dscheduledatamanager.h" createScheduleTask::createScheduleTask() @@ -40,7 +41,7 @@ Reply createScheduleTask::SchedulePress(semanticAnalysisTask &semanticTask) } if (shouldEndSession(createJsonData)) { if (!isValidDateTime) { - qInfo() << "schedule begintime or endtime is not valided!"; + qCInfo(CommonLogger) << "schedule begintime or endtime is not valided!"; //无效时间,直接返回回复语 REPLY_ONLY_TTS(m_reply, replyNotValidDT, replyNotValidDT, true); //设置时间有效标志为true @@ -48,11 +49,11 @@ Reply createScheduleTask::SchedulePress(semanticAnalysisTask &semanticTask) return m_reply; } else if (!beginDateTimeIsinHalfYear()) { if (beginDateTimeBeforeCurrent()) { - qInfo() << "schedule begintime is before currenttime!"; + qCInfo(CommonLogger) << "schedule begintime is before currenttime!"; //"我现在有点慌,因为我还不会制定过去的提醒" REPLY_ONLY_TTS(m_reply, createJsonData->SuggestMsg(), createJsonData->SuggestMsg(), true); } else if (beginDateTimeOutHalfYear()) { - qInfo() << "schedule begintime is after halfyear!"; + qCInfo(CommonLogger) << "schedule begintime is after halfyear!"; //"只能创建未来半年的日程" REPLY_ONLY_TTS(m_reply, CREATE_TIME_OUT_TTS, CREATE_TIME_OUT_TTS, true); } diff --git a/schedule-plugin/src/widget/createschedulewidget.cpp b/schedule-plugin/src/widget/createschedulewidget.cpp index 2cfba712d..5a0d85a82 100644 --- a/schedule-plugin/src/widget/createschedulewidget.cpp +++ b/schedule-plugin/src/widget/createschedulewidget.cpp @@ -7,6 +7,7 @@ #include "buttonwidget.h" #include "../globaldef.h" #include "dscheduledatamanager.h" +#include "commondef.h" #include #include @@ -102,7 +103,7 @@ void createSchedulewidget::updateUI(const QString &scheduleID) mainlayout->addWidget(m_scheduleitemwidget); setCenterLayout(mainlayout); } else { - qCritical() << "There's not the same schedule in scheduleSql!"; + qCritical(CommonLogger) << "There's not the same schedule in scheduleSql!"; } } else { //是否创建日程 diff --git a/tests/dde-calendar-client-test/src/test_dataManage/test_calendardatedatamanage.cpp b/tests/dde-calendar-client-test/src/test_dataManage/test_calendardatedatamanage.cpp index 1e74a9ca1..3a9b7bab3 100644 --- a/tests/dde-calendar-client-test/src/test_dataManage/test_calendardatedatamanage.cpp +++ b/tests/dde-calendar-client-test/src/test_dataManage/test_calendardatedatamanage.cpp @@ -40,7 +40,7 @@ //{ // QDate selectDate; // selectDate = calendarDateDataManager->getSelectDate(); -// //qInfo() << selectDate; +// //qCInfo(CommonLogger) << selectDate; //} ////void CalendarDateDataManager::setCurrentDateTime(const QDateTime ¤tDateTime) diff --git a/tests/dde-calendar-client-test/src/test_dataManage/test_schedulecoormanage.cpp b/tests/dde-calendar-client-test/src/test_dataManage/test_schedulecoormanage.cpp index a011e3d29..6c7882621 100644 --- a/tests/dde-calendar-client-test/src/test_dataManage/test_schedulecoormanage.cpp +++ b/tests/dde-calendar-client-test/src/test_dataManage/test_schedulecoormanage.cpp @@ -120,7 +120,7 @@ //{ // QPointF pos(0, 0); // QDateTime dateTime = cScheduleCoorManage->getDate(pos); -// qInfo() << dateTime; +// qCInfo(CommonLogger) << dateTime; // QPointF pos1(-1, 0); // QDateTime dateTime1 = cScheduleCoorManage->getDate(pos1); //} @@ -130,7 +130,7 @@ //{ // QPointF pos(0, 0); // QDate date = cScheduleCoorManage->getsDate(pos); -// qInfo() << date; +// qCInfo(CommonLogger) << date; // QPointF pos1(-1, 0); // cScheduleCoorManage->getsDate(pos1); //} diff --git a/tests/dde-calendar-client-test/src/test_view/test_graphicsview.cpp b/tests/dde-calendar-client-test/src/test_view/test_graphicsview.cpp index c74c9d7cb..3bc0c938d 100644 --- a/tests/dde-calendar-client-test/src/test_view/test_graphicsview.cpp +++ b/tests/dde-calendar-client-test/src/test_view/test_graphicsview.cpp @@ -114,7 +114,7 @@ //// QGraphicsItem *listItem = itemAt(point); //// DragInfoItem *infoitem = dynamic_cast(listItem); //// CScheduleItem *scheduleitem = dynamic_cast(infoitem); -//// qInfo() << scheduleitem->getType(); +//// qCInfo(CommonLogger) << scheduleitem->getType(); //// cGraphicsView->ShowSchedule(infoitem); ////} diff --git a/tests/dde-calendar-service-test/src/test_lunarandfestival/test_method_interface.cpp b/tests/dde-calendar-service-test/src/test_lunarandfestival/test_method_interface.cpp index 12a905469..d49ace9df 100644 --- a/tests/dde-calendar-service-test/src/test_lunarandfestival/test_method_interface.cpp +++ b/tests/dde-calendar-service-test/src/test_lunarandfestival/test_method_interface.cpp @@ -33,13 +33,13 @@ TEST_F(test_method_interface, GetLunarDayName) // "初八" int lundayname = 8; QString lunarDayName = GetLunarDayName(lundayname); - //qInfo() << lunarDayName; + //qCInfo(CommonLogger) << lunarDayName; assert("初八" == lunarDayName); // "廿五" lundayname = 25; lunarDayName = GetLunarDayName(lundayname); - //qInfo() << lunarDayName; + //qCInfo(CommonLogger) << lunarDayName; assert("廿五" == lunarDayName); } @@ -52,7 +52,7 @@ TEST_F(test_method_interface, GetLunarDayFestival) int lunarmonthdays = 30; int solarterm = 1; QString dayFestival = GetLunarDayFestival(monthname, lunarday, lunarmonthdays, solarterm); - //qInfo() << dayFestival; + //qCInfo(CommonLogger) << dayFestival; assert("除夕" == dayFestival); // "清明节" @@ -61,7 +61,7 @@ TEST_F(test_method_interface, GetLunarDayFestival) lunarmonthdays = 23; solarterm = 1; dayFestival = GetLunarDayFestival(monthname, lunarday, lunarmonthdays, solarterm); - //qInfo() << dayFestival; + //qCInfo(CommonLogger) << dayFestival; assert("清明节" == dayFestival); // "" @@ -70,7 +70,7 @@ TEST_F(test_method_interface, GetLunarDayFestival) lunarmonthdays = 13; solarterm = 0; dayFestival = GetLunarDayFestival(monthname, lunarday, lunarmonthdays, solarterm); - //qInfo() << dayFestival; + //qCInfo(CommonLogger) << dayFestival; assert("" == dayFestival); } @@ -174,7 +174,7 @@ TEST_F(test_method_interface, DmsToRadians) TEST_F(test_method_interface, GetDateTimeFromJulianDay) { QString strJulianDay = "周五 3月 20 03:49:33 2020 GMT"; - //qInfo() << julianDay.toString(); + //qCInfo(CommonLogger) << julianDay.toString(); assert(strJulianDay.contains(GetDateTimeFromJulianDay(GetSolarTermJD(2020, 0)).toString())); } @@ -217,5 +217,5 @@ TEST_F(test_method_interface, CalcEarthObliquityNutation) TEST_F(test_method_interface, lightAberration) { lightAberration(); - //qInfo() << lightAb; + //qCInfo(CommonLogger) << lightAb; }