chore: More logs for service#264
Merged
Merged
Conversation
Add more logs for service. Log: More logs for service.
Reviewer's GuideThis PR instruments the calendar service with extensive logging by inserting qCDebug/qCInfo/qCWarning calls (and adding necessary commondef includes) across the codebase. Key methods, constructors/destructors, decision branches, DB operations, sync flows, and timer controls now emit detailed runtime insights for improved observability. Sequence diagram for logging in DAccountModule::setExpandsequenceDiagram
participant User as actor User
participant DAccountModule
participant DAccount
participant DAccountDB
User->>DAccountModule: setExpand(isExpand)
DAccountModule->>DAccount: isExpandDisplay()
alt State changed
DAccountModule->>DAccount: setIsExpandDisplay(isExpand)
DAccountModule->>DAccountDB: updateAccountInfo()
DAccountModule->>DAccountModule: qCDebug log ("Setting expand state to ...")
else State unchanged
DAccountModule->>DAccountModule: qCDebug log ("Setting expand state to ...")
end
Sequence diagram for logging in DAccountManagerService::getAccountListsequenceDiagram
participant Client as actor Client
participant DAccountManagerService
participant DAccountManageModule
Client->>DAccountManagerService: getAccountList()
DAccountManagerService->>DAccountManagerService: qCDebug log ("Getting account list")
DAccountManagerService->>DAccountManagerService: clientWhite(0)
alt Not whitelisted
DAccountManagerService->>DAccountManagerService: qCDebug log ("Client not whitelisted, returning empty account list")
DAccountManagerService-->>Client: ""
else Whitelisted
DAccountManagerService->>DAccountManageModule: getAccountList()
DAccountManagerService->>DAccountManagerService: qCDebug log ("Retrieved account list with length: ...")
DAccountManagerService-->>Client: accountList
end
Sequence diagram for logging in DDataBaseManagement constructor (DB migration)sequenceDiagram
participant DDataBaseManagement
participant DAccountManagerDataBase
participant DAccountDataBase
participant QSqlDatabase
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("Creating DDataBaseManagement instance")
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("Setting up database paths")
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("New database path: ...")
alt New DB does not exist
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("New database does not exist, creating initial setup")
DDataBaseManagement->>DAccountManagerDataBase: setDBPath(newDB)
DDataBaseManagement->>DAccountManagerDataBase: initDBData()
DDataBaseManagement->>DAccountManagerDataBase: getAccountList()
DDataBaseManagement->>DAccountDataBase: setDBPath(localAccountDB)
DDataBaseManagement->>DAccountDataBase: initDBData()
DDataBaseManagement->>DAccountDataBase: getSysColor()
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("Mapping system colors")
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("Checking for old database at: ...")
alt Old DB exists
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("Found old database, starting migration from: ...")
DDataBaseManagement->>QSqlDatabase: addDatabase("QSQLITE", "oldDB")
DDataBaseManagement->>QSqlDatabase: open()
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("Setting up default type mappings")
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("Checking if old database has type table")
alt Has type table
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("Old database has type table, migrating types")
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("Migrating old type colors")
end
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("Migrating schedule data")
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("Checking if old database has reminder table")
alt Has reminder table
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("Migrating reminder data")
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("Migrated ... reminder entries")
end
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("Database migration completed successfully")
else No old DB
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("No old database found, skipping migration")
end
else New DB exists
DDataBaseManagement->>DDataBaseManagement: qCDebug log ("New database already exists, skipping initialization")
end
Class diagram for logging instrumentation in calendar serviceclassDiagram
class DAccountModule {
+DAccountModule(account, parent)
+~DAccountModule()
+getAccountInfo()
+getExpand()
+setExpand(isExpand)
+getAccountState()
+setAccountState(accountState)
+getSyncState()
+getSyncFreq()
+setSyncFreq(freq)
+getScheduleTypeList()
+getScheduleTypeByID(typeID)
+createScheduleType(typeInfo)
+deleteScheduleTypeByID(typeID)
+scheduleTypeByUsed(typeID)
+updateScheduleType(typeInfo)
+createSchedule(scheduleInfo)
+updateSchedule(scheduleInfo)
+getScheduleByScheduleID(scheduleID)
+deleteScheduleByScheduleID(scheduleID)
+querySchedulesWithParameter(params)
+getRemindScheduleList(dtStart, dtEnd)
+getSysColors()
+account() const
+updateRemindSchedules(isClear)
+notifyMsgHanding(alarmID, operationNum)
+remindJob(alarmID)
+accountDownload()
+uploadNetWorkAccountData()
+getDtLastUpdate()
+removeDB()
+getScheduleTimesOn(dtStart, dtEnd, scheduleList, extend)
+getFestivalSchedule(dtStart, dtEnd, key)
+extendRecurrence(scheduleMap, schedule, dtStart, dtEnd, extend)
+closeNotification(scheduleId)
+getScheduleByRemind(remindData)
+downloadTaskhanding(index)
+uploadTaskHanding(open)
+slotOpenCalendar(alarmID)
+slotSyncState(syncState)
+slotDateUpdate(updateType)
+importSchedule(icsFilePath, typeID, cleanExists)
+exportSchedule(icsFilePath, typeID)
}
class DAccountManageModule {
+DAccountManageModule(parent)
+getAccountList()
+getCalendarGeneralSettings()
+setCalendarGeneralSettings(cgSet)
+getfirstDayOfWeek()
+setFirstDayOfWeek(firstday)
+getTimeFormatType()
+setTimeFormatType(timeType)
+remindJob(accountID, alarmID)
+updateRemindSchedules(isClear)
+notifyMsgHanding(accountID, alarmID, operationNum)
+downloadByAccountID(accountID)
+uploadNetWorkAccountData()
+login()
+logout()
+isSupportUid()
+calendarOpen(isOpen)
+unionIDDataMerging()
+initAccountDBusInfo(account)
+removeUIdAccount(uidAccount)
+addUIdAccount(uidAccount)
+updateUIdAccount(oldAccount, uidAccount)
+setUidSwitchStatus(account)
+getGeneralSettings()
+setGeneralSettings(cgSet)
+slotFirstDayOfWeek(firstDay)
+slotTimeFormatType(timeType)
+getFirstDayOfWeekSource()
+setFirstDayOfWeekSource(source)
+getTimeFormatTypeSource()
+setTimeFormatTypeSource(source)
+slotUidLoginStatueChange(status)
+slotSwitcherChange(state)
+slotSettingChange()
+slotClientIsOpen()
}
class DDataBaseManagement {
+DDataBaseManagement()
+newDatabasePath() const
+setNewDatabasePath(newDatabasePath)
+oldDatabasePath() const
+setOldDatabasePath(oldDatabasePath)
+databaseExists(databasePath, create)
+hasLunnarField(db)
+hasTypeDB(db)
+hasRemindDB(db)
+queryOldJobTypeData(db)
+queryOldJobData(db, haslunar)
+queryOldTypeColorData(db)
+querOldRemindData(db)
+hasTransfer() const
}
class DDataBase {
+DDataBase(parent)
+~DDataBase()
+getDBPath() const
+setDBPath(DBPath)
+createUuid()
+getConnectionName() const
+setConnectionName(connectionName)
+initDBData()
+dbOpen()
+dbFileExists()
+removeDB()
}
class DRemindData {
+DRemindData()
+accountID() const
+setAccountID(accountID)
+scheduleID() const
+setScheduleID(scheduleID)
+recurrenceId() const
+setRecurrenceId(recurrenceId)
+remindCount() const
+setRemindCount(remindCount)
+notifyid() const
+setNotifyid(notifyid)
+dtRemind() const
+setDtRemind(dtRemind)
+dtStart() const
+setDtStart(dtStart)
+dtEnd() const
+setDtEnd(dtEnd)
+alarmID() const
+setAlarmID(alarmID)
+updateRemindTimeByCount()
+updateRemindTimeByMesc(duration)
+getRemindTimeByMesc(duration)
}
class DUploadTaskData {
+DUploadTaskData()
+sql_table_name(task_obj)
+sql_table_primary_key(task_obj)
+taskType() const
+setTaskType(taskType)
+taskObject() const
+setTaskObject(taskObject)
+objectId() const
+setObjectId(objectId)
+taskID() const
+setTaskID(taskID)
+dtCreate() const
+setDtCreate(dtCreate)
}
class DServiceBase {
+DServiceBase(path, interface, parent)
+getPath() const
+getInterface() const
+getClientName()
+clientWhite(index)
+notifyPropertyChanged(interface, propertyName)
}
class DHuangLiDataBase {
+DHuangLiDataBase(parent)
+readJSON(filename, cache)
+updateFestivalList()
+queryFestivalList(year, month)
+queryHuangLiByDays(days)
+initDBData()
+createDB()
}
class CalendarHuangLi {
+CalendarHuangLi(parent)
+getFestivalMonth(year, month)
+getHuangLiDay(year, month, day)
+getHuangLiMonth(year, month, fill)
+getLunarInfoBySolar(year, month, day)
+getLunarCalendarMonth(year, month, fill)
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Note
详情{
"calendar-service/src/dbmanager/dhuanglidatabase.cpp": [
{
"line": "const QString HolidayUpdateURLPrefix =\"https://cdn-nu-common.uniontech.com/deepin-calendar\";",
"line_number": 21,
"rule": "S35",
"reason": "Url link | 0b2e847e1f"
}
],
"calendar-service/src/calendarDataManager/daccountmanagemodule.cpp": [
{
"line": "const QString firstDayOfWeek_key = \"firstDayOfWeek\";",
"line_number": 12,
"rule": "S106",
"reason": "Var naming | dc5ba3cd3f"
},
{
"line": "const QString shortTimeFormat_key = \"shortTimeFormat\";",
"line_number": 13,
"rule": "S106",
"reason": "Var naming | 7e44ab71d7"
},
{
"line": "const QString firstDayOfWeekSource_key = \"firstDayOfWeekSource\";",
"line_number": 14,
"rule": "S106",
"reason": "Var naming | 615e50c973"
},
{
"line": "const QString shortTimeFormatSource_key = \"shortTimeFormatSource\";",
"line_number": 15,
"rule": "S106",
"reason": "Var naming | da98f021ed"
}
]
} |
lzwind
approved these changes
Jul 22, 2025
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, re2zero The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
Author
|
/merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add more logs for service.
Log: More logs for service.
Summary by Sourcery
Add comprehensive debug logging to the calendar service modules to improve runtime traceability of constructors, destructors, method calls, database operations, D-Bus interactions, systemd timer control, and synchronization workflows.
Enhancements: