Skip to content

Commit 71af5d5

Browse files
re2zerodeepin-bot[bot]
authored andcommitted
chore: More logs for service
Add more logs for service. Log: More logs for service.
1 parent 925b6f4 commit 71af5d5

24 files changed

Lines changed: 591 additions & 33 deletions

calendar-service/src/alarmManager/dalarmmanager.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ static QString layoutHM("15:04");
2727
DAlarmManager::DAlarmManager(QObject *parent)
2828
: QObject(parent)
2929
{
30+
qCDebug(ServiceLogger) << "DAlarmManager constructor called.";
3031
m_dbusnotify = new DBusNotify("org.deepin.dde.Notification1",
3132
"/org/deepin/dde/Notification1",
3233
"org.deepin.dde.Notification1",
@@ -69,6 +70,7 @@ void DAlarmManager::updateRemind(const DRemindData::List &remindList)
6970
info.triggerTimer = remind->dtRemind();
7071
infoVector.append(info);
7172
}
73+
qCDebug(ServiceLogger) << "Building systemd timer configuration for" << infoVector.size() << "reminders.";
7274
systemdTimerControl.buildingConfiggure(infoVector);
7375
}
7476

@@ -90,11 +92,13 @@ void DAlarmManager::notifyJobsChanged(const DRemindData::List &remindList)
9092
info.triggerTimer = remind->dtRemind();
9193
infoVector.append(info);
9294
}
95+
qCDebug(ServiceLogger) << "Stopping systemd timers for" << infoVector.size() << "changed jobs.";
9396
systemdTimerControl.stopSystemdTimerByJobInfos(infoVector);
9497
}
9598

9699
void DAlarmManager::notifyMsgHanding(const DRemindData::Ptr &remindData, const int operationNum)
97100
{
101+
qCDebug(ServiceLogger) << "Notifying message handling for alarm:" << remindData->alarmID();
98102
switch (operationNum) {
99103
case 1:
100104
qCDebug(ServiceLogger) << "Opening calendar UI for alarm:" << remindData->alarmID();
@@ -122,6 +126,7 @@ void DAlarmManager::remindLater(const DRemindData::Ptr &remindData, const int op
122126
SystemDInfo info;
123127
info.accountID = remindData->accountID();
124128
info.alarmID = remindData->alarmID();
129+
qCDebug(ServiceLogger) << "Reminding later for alarm:" << info.alarmID << "account:" << info.accountID << "operation:" << operationNum;
125130

126131
//如果是稍后提醒则设置对应的重复次数
127132
if (operationNum == 2) {
@@ -133,6 +138,7 @@ void DAlarmManager::remindLater(const DRemindData::Ptr &remindData, const int op
133138
info.triggerTimer = remindData->dtRemind();
134139

135140
//停止相应的任务
141+
qCDebug(ServiceLogger) << "Stopping original systemd timer.";
136142
systemdTimerControl.stopSystemdTimerByJobInfo(info);
137143

138144
if (operationNum != 2) {
@@ -144,6 +150,7 @@ void DAlarmManager::remindLater(const DRemindData::Ptr &remindData, const int op
144150
QVector<SystemDInfo> infoVector;
145151
infoVector.append(info);
146152
//开启新任务
153+
qCDebug(ServiceLogger) << "Building new systemd timer configuration for reminded job.";
147154
systemdTimerControl.buildingConfiggure(infoVector);
148155
}
149156

@@ -227,16 +234,19 @@ int DAlarmManager::remindJob(const DRemindData::Ptr &remindData, const DSchedule
227234
<< "Actions:" << actionlist.size();
228235

229236
int notifyid = m_dbusnotify->Notify(argumentList);
237+
qCDebug(ServiceLogger) << "Notification sent, ID:" << notifyid;
230238
return notifyid;
231239
}
232240

233241
DBusNotify *DAlarmManager::getdbusnotify()
234242
{
243+
// qCDebug(ServiceLogger) << "Getting DBusNotify instance.";
235244
return m_dbusnotify;
236245
}
237246

238247
QString DAlarmManager::getRemindBody(const DSchedule::Ptr &schedule)
239248
{
249+
qCDebug(ServiceLogger) << "Generating reminder body for schedule:" << schedule->summary();
240250
QDateTime tm = QDateTime::currentDateTime();
241251
QString msgStart;
242252
QString msgEnd;
@@ -283,6 +293,7 @@ QString DAlarmManager::getBodyTimePart(const QDateTime &nowtime, const QDateTime
283293
//ToDo 需确认规则,需根据isstart确认是否为开始时间单独处理
284294
QString strmsg;
285295
qint64 diff = nowtime.daysTo(jobtime); //jobtime只可能大于等于当前remind任务执行的当前时间
296+
qCDebug(ServiceLogger) << "Generating body time part. Diff days:" << diff << "All day:" << allday;
286297
if (allday) {
287298
//全天日程,只展示日期,即date
288299
//日程开始时间距离现在超过两天
@@ -321,11 +332,13 @@ QString DAlarmManager::getBodyTimePart(const QDateTime &nowtime, const QDateTime
321332

322333
int DAlarmManager::getRemindLaterDuration(int count, qint64 &duration)
323334
{
335+
qCDebug(ServiceLogger) << "Calculating remind later duration for count:" << count;
324336
bool bmax = false;
325337
duration = (10 + ((count - 1) * 5)) * Minute; //下一次提醒距离现在的时间间隔,单位毫秒
326338
if (duration >= Hour) {
327339
bmax = true;
328340
duration = Hour;
329341
}
342+
qCDebug(ServiceLogger) << "Calculated duration:" << duration << "ms. Max reached:" << bmax;
330343
return bmax;
331344
}

calendar-service/src/alarmManager/dreminddata.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// SPDX-License-Identifier: LGPL-3.0-or-later
44

55
#include "dreminddata.h"
6+
#include "commondef.h"
67

78
DRemindData::DRemindData()
89
: m_alarmID("")
@@ -11,117 +12,142 @@ DRemindData::DRemindData()
1112
, m_remindCount(0)
1213
, m_notifyid(-1)
1314
{
15+
// qCDebug(ServiceLogger) << "DRemindData default constructor called.";
1416
}
1517

1618
QString DRemindData::accountID() const
1719
{
20+
// qCDebug(ServiceLogger) << "Getting accountID:" << m_accountID;
1821
return m_accountID;
1922
}
2023

2124
void DRemindData::setAccountID(const QString &accountID)
2225
{
26+
// qCDebug(ServiceLogger) << "Setting accountID to:" << accountID;
2327
m_accountID = accountID;
2428
}
2529

2630
QString DRemindData::scheduleID() const
2731
{
32+
// qCDebug(ServiceLogger) << "Getting scheduleID:" << m_scheduleID;
2833
return m_scheduleID;
2934
}
3035

3136
void DRemindData::setScheduleID(const QString &scheduleID)
3237
{
38+
// qCDebug(ServiceLogger) << "Setting scheduleID to:" << scheduleID;
3339
m_scheduleID = scheduleID;
3440
}
3541

3642
QDateTime DRemindData::recurrenceId() const
3743
{
44+
// qCDebug(ServiceLogger) << "Getting recurrenceId:" << m_recurrenceId;
3845
return m_recurrenceId;
3946
}
4047

4148
void DRemindData::setRecurrenceId(const QDateTime &recurrenceId)
4249
{
50+
// qCDebug(ServiceLogger) << "Setting recurrenceId to:" << recurrenceId;
4351
m_recurrenceId = recurrenceId;
4452
}
4553

4654
int DRemindData::remindCount() const
4755
{
56+
// qCDebug(ServiceLogger) << "Getting remindCount:" << m_remindCount;
4857
return m_remindCount;
4958
}
5059

5160
void DRemindData::setRemindCount(int remindCount)
5261
{
62+
// qCDebug(ServiceLogger) << "Setting remindCount to:" << remindCount;
5363
m_remindCount = remindCount;
5464
}
5565

5666
int DRemindData::notifyid() const
5767
{
68+
// qCDebug(ServiceLogger) << "Getting notifyid:" << m_notifyid;
5869
return m_notifyid;
5970
}
6071

6172
void DRemindData::setNotifyid(int notifyid)
6273
{
74+
// qCDebug(ServiceLogger) << "Setting notifyid to:" << notifyid;
6375
m_notifyid = notifyid;
6476
}
6577

6678
QDateTime DRemindData::dtRemind() const
6779
{
80+
// qCDebug(ServiceLogger) << "Getting dtRemind:" << m_dtRemind;
6881
return m_dtRemind;
6982
}
7083

7184
void DRemindData::setDtRemind(const QDateTime &dtRemind)
7285
{
86+
// qCDebug(ServiceLogger) << "Setting dtRemind to:" << dtRemind;
7387
m_dtRemind = dtRemind;
7488
}
7589

7690
QDateTime DRemindData::dtStart() const
7791
{
92+
// qCDebug(ServiceLogger) << "Getting dtStart:" << m_dtStart;
7893
return m_dtStart;
7994
}
8095

8196
void DRemindData::setDtStart(const QDateTime &dtStart)
8297
{
98+
// qCDebug(ServiceLogger) << "Setting dtStart to:" << dtStart;
8399
m_dtStart = dtStart;
84100
}
85101

86102
QDateTime DRemindData::dtEnd() const
87103
{
104+
// qCDebug(ServiceLogger) << "Getting dtEnd:" << m_dtEnd;
88105
return m_dtEnd;
89106
}
90107

91108
void DRemindData::setDtEnd(const QDateTime &dtEnd)
92109
{
110+
// qCDebug(ServiceLogger) << "Setting dtEnd to:" << dtEnd;
93111
m_dtEnd = dtEnd;
94112
}
95113

96114
QString DRemindData::alarmID() const
97115
{
116+
// qCDebug(ServiceLogger) << "Getting alarmID:" << m_alarmID;
98117
return m_alarmID;
99118
}
100119

101120
void DRemindData::setAlarmID(const QString &alarmID)
102121
{
122+
// qCDebug(ServiceLogger) << "Setting alarmID to:" << alarmID;
103123
m_alarmID = alarmID;
104124
}
105125

106126
void DRemindData::updateRemindTimeByCount()
107127
{
128+
qCDebug(ServiceLogger) << "Updating remind time by count. Current count:" << m_remindCount;
108129
qint64 Minute = 60 * 1000;
109130
qint64 Hour = Minute * 60;
110131
qint64 duration = (10 + ((m_remindCount - 1) * 5)) * Minute; //下一次提醒距离现在的时间间隔,单位毫秒
111132
if (duration >= Hour) {
133+
qCDebug(ServiceLogger) << "Duration is greater than or equal to one hour, setting to one hour";
112134
duration = Hour;
113135
}
136+
qCDebug(ServiceLogger) << "Calculated duration:" << duration << "ms.";
114137
setDtRemind(getRemindTimeByMesc(duration));
115138
}
116139

117140
void DRemindData::updateRemindTimeByMesc(qint64 duration)
118141
{
142+
qCDebug(ServiceLogger) << "Updating remind time by milliseconds:" << duration;
119143
setDtRemind(getRemindTimeByMesc(duration));
120144
}
121145

122146
QDateTime DRemindData::getRemindTimeByMesc(qint64 duration)
123147
{
148+
qCDebug(ServiceLogger) << "Getting remind time by milliseconds from now. Duration:" << duration;
124149
QDateTime currentTime = QDateTime::currentDateTime();
125150
currentTime = currentTime.addMSecs(duration);
151+
qCDebug(ServiceLogger) << "New remind time:" << currentTime;
126152
return currentTime;
127153
}

0 commit comments

Comments
 (0)