Skip to content

chore: More logs for common#259

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:develop/snipefrom
re2zero:bugfix
Jul 15, 2025
Merged

chore: More logs for common#259
deepin-bot[bot] merged 1 commit into
linuxdeepin:develop/snipefrom
re2zero:bugfix

Conversation

@re2zero
Copy link
Copy Markdown
Contributor

@re2zero re2zero commented Jul 14, 2025

Add more logs for common.

Log: More logs for common.

Summary by Sourcery

Enhance observability in calendar-common by adding pervasive debug logging using CommonLogger, consolidating log sources, and improving traceability of key operations.

Enhancements:

  • Add qCDebug(CommonLogger) calls throughout constructors, getters/setters, JSON/ICS serialization, D-Bus interactions, lunar computations, pinyin search, and compatibility methods
  • Replace ServiceLogger references with CommonLogger for consistent logging across modules
  • Include commondef.h where needed to enable new CommonLogger debug statements

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jul 14, 2025

Reviewer's Guide

This PR enriches and unifies debug logging across the calendar-common module by replacing ServiceLogger targets with a CommonLogger, adding necessary commondef includes, and inserting detailed qCDebug/qCWarning calls at key code paths. Many non-critical logs have been added as commented placeholders for future activation.

Class diagram for updated logging in calendar-common

classDiagram
    class DAccount {
        +DAccount(Type type)
        +setAccountID(QString accountID)
        +setDbusInterface(QString dbusInterface)
        +setAccountState(AccountStates accountState)
        +fromJsonString(Ptr &account, const QString &jsonStr)
        +toJsonListString(const DAccount::List &accountList, QString &jsonStr)
        +fromJsonListString(List &accountList, const QString &jsonStr)
        +syncFreqToJsonString(const DAccount::Ptr &account)
        +syncFreqFromJsonString(const DAccount::Ptr &account, const QString &syncFreqStr)
        <<uses CommonLogger for debug and warning logs>>
    }

    class DScheduleType {
        +setDeleted(int deleted)
        +fromJsonString(DScheduleType::Ptr &scheduleType, const QString &jsonStr)
        +toJsonString(const DScheduleType::Ptr &scheduleType, QString &jsonStr)
        +fromJsonListString(DScheduleType::List &stList, const QString &jsonStr)
        +toJsonListString(const DScheduleType::List &stList, QString &jsonStr)
        <<uses CommonLogger for debug and warning logs>>
    }

    class DSchedule {
        +DSchedule()
        +DSchedule(const DSchedule &schedule)
        +setAlarmType(const DSchedule::AlarmType &alarmType)
        +setRRuleType(const DSchedule::RRuleType &rtype)
        +fromJsonString(DSchedule::Ptr &schedule, const QString &json)
        +toJsonString(const DSchedule::Ptr &schedule, QString &json)
        <<uses CommonLogger for debug and warning logs>>
    }

    class DTypeColor {
        +DTypeColor()
        +DTypeColor(const DTypeColor &typeColor)
        +fromJsonString(const QString &colorJson)
        +toJsonString(const DTypeColor::List &colorList)
        <<uses CommonLogger for debug logs>>
    }

    class DBusTimedate {
        +DBusTimedate(QObject *parent)
        +shortTimeFormat()
        +shortDateFormat()
        +weekBegins()
        +propertiesChanged(const QDBusMessage &msg)
        +getPropertyByName(const char *porpertyName)
        +getHasDateTimeFormat()
        <<uses CommonLogger for debug and warning logs>>
    }

    class LunarDateInfo {
        +getRRuleStartDate(const QDate &beginDate, const QDate &endDate, const QDate &solarDate)
        +getAllNextMonthLunarDayBySolar(const QDate &solarDate)
        +getAllNextYearLunarDayBySolar(const QDate &solarDate)
        +ParseRRule(const QString &rule)
        +addSolarMap(QMap<int, QDate> &solarMap, QDate &nextDate, int &count, const int addDays)
        <<uses CommonLogger for debug and warning logs>>
    }

    class LunarCalendar {
        +LogOffEmptyData()
        <<uses CommonLogger for debug logs>>
    }

    class pinyinsearch {
        +pinyinsearch()
        +getPinPinSearch()
        +CreatePinyin(const QString &zh)
        +initDict()
        <<uses CommonLogger for debug and warning logs>>
    }

    class DDE_Calendar {
        +getNewTypeIDByOldTypeID(int oldTypeID)
        +getOldTypeIDByNewTypeID(const QString &newTypeID)
        +getExternalSchedule(const DSchedule::Map &scheduleMap)
        +setAlarmByOldRemind(const DSchedule::Ptr &schedule, const QString &remind)
        +getOldRemindByAlarm(const DSchedule::AlarmType &alarmType)
        +getScheduleByExported(const QString &scheduleStr)
        +setRRuleByOldRRule(const DSchedule::Ptr &schedule, const QString &rrule)
        +setExDate(const DSchedule::Ptr &schedule, const QJsonArray &ignore)
        <<uses CommonLogger for debug and warning logs>>
    }

    class CaLunarDayInfo {
        +registerMetaType()
        <<uses CommonLogger for debug logs>>
    }

    class CaHuangLiDayInfo {
        +toJson()
        +strJsonToInfo(const QString &strJson, bool &isVaild)
        +jsonObjectToInfo(const QJsonObject &jsonObject)
        <<uses CommonLogger for debug logs>>
    }

    class CaHuangLiMonthInfo {
        +toJson()
        +strJsonToInfo(const QString &strJson, bool &isVaild)
        +clear()
        <<uses CommonLogger for debug logs>>
    }

    class DScheduleQueryPar {
        +DScheduleQueryPar()
        +fromJsonString(const QString &queryStr)
        +toJsonString(const DScheduleQueryPar::Ptr &queryPar)
        <<uses CommonLogger for debug and warning logs>>
    }

    class Units {
        +getHomeConfigPath()
        +DownloadFile(QString url, QString filename)
        <<uses CommonLogger for debug logs>>
    }
Loading

File-Level Changes

Change Details Files
Standardize active logging to CommonLogger and include common definitions
  • Replaced qCDebug(ServiceLogger) with qCDebug(CommonLogger)
  • Replaced qCWarning(ServiceLogger) with qCWarning(CommonLogger)
  • Added #include "commondef.h" where missing
calendar-common/src/dscheduletype.cpp
calendar-common/src/dschedule.cpp
calendar-common/src/daccount.cpp
calendar-common/src/method_interface.cpp
calendar-common/src/dbustimedate.cpp
Add detailed debug traces at constructors, API entry points, conversions and data processing
  • Inserted qCDebug(CommonLogger) in constructors and copy constructors
  • Logged entry and exit of JSON/ICS parsing and serialization methods
  • Logged recurrences expansion, DBus property changes, lunar/festival computations, pinyin dictionary initialization and queries
calendar-common/src/dschedulequerypar.cpp
calendar-common/src/lunarandfestival/lunarcalendar.cpp
calendar-common/src/lunarandfestival/lunardateinfo.cpp
calendar-common/src/lunarandfestival/lunarmanager.cpp
calendar-common/src/pinyin/pinyinsearch.cpp
calendar-common/src/compatibledata.cpp
calendar-common/src/units.cpp
calendar-common/src/dcalendargeneralsettings.cpp
Introduce commented-out debug placeholders for optional tracing
  • Prefixed many getters, setters and comparison operators with commented qCDebug(CommonLogger)
  • Left placeholders throughout classes for future detailed tracing
calendar-common/src/dscheduletype.cpp
calendar-common/src/dschedule.cpp
calendar-common/src/daccount.cpp
calendar-common/src/dtypecolor.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions
Copy link
Copy Markdown

  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "calendar-common/src/lunarandfestival/method_interface.cpp": [
        {
            "line": "    return TianGan[num % 10] + DiZhi[num % 12];",
            "line_number": 84,
            "rule": "C151",
            "reason": "政治敏感词 | 8503710310"
        }
    ]
}

@github-actions
Copy link
Copy Markdown

  • 检测到debian目录文件有变更: debian/rules

@github-actions
Copy link
Copy Markdown

  • 检测到debian目录文件有变更: debian/rules

@github-actions
Copy link
Copy Markdown

  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "calendar-common/src/lunarandfestival/method_interface.cpp": [
        {
            "line": "    return TianGan[num % 10] + DiZhi[num % 12];",
            "line_number": 84,
            "rule": "C151",
            "reason": "政治敏感词 | 8503710310"
        }
    ]
}

@github-actions
Copy link
Copy Markdown

  • 检测到debian目录文件有变更: debian/rules

@github-actions
Copy link
Copy Markdown

  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "calendar-common/src/lunarandfestival/method_interface.cpp": [
        {
            "line": "    return TianGan[num % 10] + DiZhi[num % 12];",
            "line_number": 84,
            "rule": "C151",
            "reason": "政治敏感词 | 8503710310"
        }
    ]
}

Add more logs for common.

Log: More logs for common.
@github-actions
Copy link
Copy Markdown

  • 检测到debian目录文件有变更: debian/rules

@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

关键摘要:

  • 在多个文件中,注释掉的调试信息(如 qCDebugqCWarning)应该被移除,除非它们是用于调试的。
  • DAccount 类的多个方法中,注释掉的调试信息应该被移除。
  • DSchedule 类的多个方法中,注释掉的调试信息应该被移除。
  • DScheduleType 类的多个方法中,注释掉的调试信息应该被移除。
  • DTypeColor 类的多个方法中,注释掉的调试信息应该被移除。
  • DBusTimedate 类的多个方法中,注释掉的调试信息应该被移除。
  • DCalendarGeneralSettings 类的多个方法中,注释掉的调试信息应该被移除。
  • pinyinsearch 类的多个方法中,注释掉的调试信息应该被移除。
  • units 类的多个方法中,注释掉的调试信息应该被移除。
  • lunarcalendar 类的多个方法中,注释掉的调试信息应该被移除。
  • lunardateinfo 类的多个方法中,注释掉的调试信息应该被移除。
  • lunarmanager 类的多个方法中,注释掉的调试信息应该被移除。
  • method_interface 类的多个方法中,注释掉的调试信息应该被移除。

是否建议立即修改:

@github-actions
Copy link
Copy Markdown

  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "calendar-common/src/lunarandfestival/method_interface.cpp": [
        {
            "line": "    return TianGan[num % 10] + DiZhi[num % 12];",
            "line_number": 84,
            "rule": "C151",
            "reason": "政治敏感词 | 8503710310"
        }
    ]
}

@deepin-ci-robot
Copy link
Copy Markdown

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@re2zero
Copy link
Copy Markdown
Contributor Author

re2zero commented Jul 15, 2025

/forcemerge

@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot Bot commented Jul 15, 2025

This pr force merged! (status: unstable)

@deepin-bot deepin-bot Bot merged commit a594251 into linuxdeepin:develop/snipe Jul 15, 2025
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants